diff --git a/src/NT8.Strategies/Examples/SimpleORBStrategy.cs b/src/NT8.Strategies/Examples/SimpleORBStrategy.cs index f34857d..88e00a5 100644 --- a/src/NT8.Strategies/Examples/SimpleORBStrategy.cs +++ b/src/NT8.Strategies/Examples/SimpleORBStrategy.cs @@ -157,18 +157,18 @@ namespace NT8.Strategies.Examples ? context.Session.SessionStart : context.CurrentTime.Date.AddHours(9.5); - // Validate session start is a legitimate RTH boundary (08:00-10:30 ET). - // Rejects spurious ETH-derived session boundaries that can reset _tradeTaken mid-session. + // Guard: only reset when the TRADING DATE has changed, not just the session + // start timestamp. Using trading date prevents mid-session resets caused by + // _openingRangeStart holding a stale value from a previous day. + DateTime thisTradingDate = thisSessionStart.Date; + TimeSpan sessionStartTime = thisSessionStart.TimeOfDay; bool isValidRthSessionStart = sessionStartTime >= new TimeSpan(8, 0, 0) && sessionStartTime <= new TimeSpan(10, 30, 0); - if (isValidRthSessionStart) + if (isValidRthSessionStart && thisTradingDate != _currentSessionDate) { - if (thisSessionStart != _openingRangeStart || _currentSessionDate == DateTime.MinValue) - { - ResetSession(thisSessionStart); - } + ResetSession(thisSessionStart); } // Only trade during RTH