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:
@@ -443,11 +443,11 @@ namespace NT8.Strategies.Examples
|
||||
maxDailyTrades = (int)mdv;
|
||||
}
|
||||
|
||||
if (_tradeTaken && _dailyTradeCount >= maxDailyTrades)
|
||||
if (_dailyTradeCount >= maxDailyTrades)
|
||||
{
|
||||
if (_logger != null)
|
||||
_logger.LogDebug(
|
||||
"SimpleORBStrategy skip: daily trade limit reached ({0}/{1}) for session {2:yyyy-MM-dd}; bar={3:yyyy-MM-dd HH:mm}; symbol={4}",
|
||||
_logger.LogInformation(
|
||||
"MaxDailyTrades reached ({0}/{1}) for session {2:yyyy-MM-dd}; rejecting signal at {3:yyyy-MM-dd HH:mm}; symbol={4}",
|
||||
_dailyTradeCount,
|
||||
maxDailyTrades,
|
||||
_currentSessionDate,
|
||||
@@ -748,7 +748,8 @@ namespace NT8.Strategies.Examples
|
||||
}
|
||||
}
|
||||
|
||||
// GAP-006: clear_trade_taken from NT8StrategyBase.OnPositionUpdate when position goes flat
|
||||
// Retained for compatibility with older adapters. Position-flat state must not
|
||||
// reset session-scoped trade eligibility; ResetSession owns the daily reset.
|
||||
if (parameters.ContainsKey("clear_trade_taken"))
|
||||
{
|
||||
var val = parameters["clear_trade_taken"];
|
||||
@@ -756,11 +757,10 @@ namespace NT8.Strategies.Examples
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
_tradeTaken = false;
|
||||
_breakoutBarSeen = false;
|
||||
_pendingBreakoutDirection = 0;
|
||||
if (_logger != null)
|
||||
_logger.LogInformation("Position-close re-arm: _tradeTaken cleared");
|
||||
_logger.LogInformation("Position flat: MaxDailyTrades count retained until session rollover");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user