GAP-032: enforce session daily trade limit
- retain accepted-trade count after position-flat events - reject same-session entries with explicit MaxDailyTrades logging - verify next-session re-entry and update Gate 3 governance Build: clean | Tests: 500 passing | Dual-deployed: yes
This commit is contained in:
@@ -839,19 +839,13 @@ namespace NinjaTrader.NinjaScript.Strategies
|
||||
FileLog(string.Format("PNL_UPDATE DayPnL={0:C} Position={1} Qty={2}",
|
||||
dayPnL, marketPosition, quantity));
|
||||
|
||||
// GAP-006: Clear _tradeTaken when position goes flat (position-close-driven re-arm)
|
||||
// This replaces the bar-driven re-arm in SimpleORBStrategy which was unreliable
|
||||
// Position state must not reset the session-scoped daily trade limit.
|
||||
if (marketPosition == MarketPosition.Flat || quantity == 0)
|
||||
{
|
||||
if (_sdkStrategy != null && _sdkStrategy.GetParameters().ContainsKey("force_session_reset"))
|
||||
{
|
||||
// Let the strategy handle its own tradeTaken flag
|
||||
_sdkStrategy.SetParameters(new Dictionary<string, object> { { "clear_trade_taken", true } });
|
||||
}
|
||||
if (EnableVerboseLogging)
|
||||
Print(string.Format("[SDK] Position flat detected — clearing tradeTaken flag"));
|
||||
Print(string.Format("[SDK] Position flat detected — daily trade count remains active until session rollover"));
|
||||
if (EnableFileLogging && State == State.Realtime)
|
||||
FileLog("POSITION FLAT — clearing tradeTaken flag");
|
||||
FileLog("POSITION FLAT — daily trade count remains active until session rollover");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user