# Architecture Decisions Use this file to record durable project decisions that affect implementation patterns, interfaces, or workflow. ## Decision Template - ID: DEC-YYYYMMDD-XX - Date: - Status: proposed | accepted | superseded - Context: - Decision: - Consequences: - Related Files: ## Decision Log ### DEC-20260823-01 - **ID:** DEC-20260823-01 - **Date:** 2026-08-23 - **Status:** **accepted** (2026-08-23) - **Operator Decision (2026-08-23):** Approved — proceed with the designed weights. - **Implementation approach resolved (Claude, 2026-08-23):** Read `ConfluenceScorer.cs` directly rather than assume. Two things confirmed that shape Part 2: (1) `Score()`'s composite (`weightedScoreSum / totalWeight`, ~line 183) already normalizes dynamically by whatever weights are actually applied — it is NOT hardcoded to divide by 10 or 5.85, so there is no separate normalization defect to fix; removing the bug is sufficient on its own. (2) The five wrong weights are hardcoded `1.0` literals in the constructor (`ConfluenceScorer.cs` ~113-117) rather than the calculators' own designed values ever being consulted, even though a `ResolveWeight()`/`UpdateFactorWeights()` mechanism already exists to make the dictionary the authoritative source — this reads as a placeholder value that was never replaced, not an architectural gap. **Resolved fix: change the five literals directly** (`NarrowRange 1.0→0.20`, `OrbRangeVsAtr 1.0→0.15`, `GapDirectionAlignment 1.0→0.15`, `BreakoutVolumeStrength 1.0→0.20`, `PriorDayCloseStrength 1.0→0.15`, verified against `FactorCalculators.cs` lines 569/670/797/897/1021) rather than removing the pre-population and routing through `ResolveWeight`'s fallback path — smaller diff, same result, keeps the dictionary as the single source of truth the API already assumes. The "configuration-driven" alternative floated in the original task is not pursued now — no scenario surfaced that needs it, and it would add parameter surface for no behavioral benefit. Flag if you want it anyway. - **Context:** GAP-047 Part 1 completed the offline equal-weight versus designed-weight re-scoring study against existing NT8 SDK session logs. The study scanned 182 `session_*.log` files under `C:\Users\billy\Documents\NinjaTrader 8\log\nt8-sdk`, including `ARCHIVE`, and reproduced the required worked example from `session_20260818_071117.log` at 10:10:11.833: equal=0.640, designed=0.727. The `STATE:` telemetry population remains direction-degraded by GAP-049 and is reported separately from real signal samples. No runtime trading code was changed. - **Evidence:** `tools/rescore/GAP-047_weight_rescore_output.md` and `.json`. Headline results: `STATE:` telemetry samples=923, designed weights crossed A while equal weights did not in 82 samples and crossed B while equal weights did not in 164 samples. Real signal factor samples=81, designed weights crossed A while equal weights did not in 25 samples. Current logs contained 0 `SIGNAL_DETAIL:` lines; signal scoring used real `SIGNAL` lines followed by their numeric `Factors:` breakdowns. - **Decision:** Replace the accidental equal 1.00 weights with the designed factor weights, per the resolved implementation approach above. Staged as `TASK_GAP047_PART2_WEIGHT_RUNTIME_PROMPT.md`. - **Consequences:** Designed weights will materially increase grade eligibility in the direction-degraded telemetry population and upgrade a meaningful subset of real signal samples to Grade A — this is the intended effect, directly targeting the low-trade-frequency problem. Because some real signal samples also downgrade under designed weights, this is a scoring-policy change, not a pure relaxation — expect a shift in which setups qualify, not just how many. Unlike GAP-054, this change is fully testable in the platform-neutral `NT8.Core` layer with ordinary unit tests — no NinjaTrader-specific managed-order call is involved, so no SIM trade is required to prove correctness (see `TASK_GAP047_PART2_WEIGHT_RUNTIME_PROMPT.md` Validation). A fresh gate configuration freeze/baseline is still required before any gate evidence is collected after this lands, since trade-qualification behavior changes. Also worth revisiting once live: the workspace currently runs `MinTradeGrade=4` (B) while the Gate 3 plan targets `MinTradeGrade=A` (5) — now that Grade A is actually reachable, the operator may want to reconsider which threshold to gate on. - **Related Files:** `tools/rescore/rescore_weights.py`, `tools/rescore/GAP-047_weight_rescore_output.md`, `tools/rescore/GAP-047_weight_rescore_output.json`, `TASK_GAP047_WEIGHT_RESCORE_PROMPT.md`, `TASK_GAP047_PART2_WEIGHT_RUNTIME_PROMPT.md`, `src/NT8.Core/Intelligence/ConfluenceScorer.cs` - **Implementation Note (2026-08-23):** Implemented in `src/NT8.Core/Intelligence/ConfluenceScorer.cs` by changing only the five approved constructor baseline weights: `NarrowRange=0.20`, `OrbRangeVsAtr=0.15`, `GapDirectionAlignment=0.15`, `BreakoutVolumeStrength=0.20`, and `PriorDayCloseStrength=0.15`. `Score()` normalization, `ResolveWeight()`, `UpdateFactorWeights()`, factor calculators, grade thresholds, and adapter/NinjaScript files were left unchanged. Added `ConfluenceScorerTests` coverage proving the default total weight is 5.85, the 2026-08-18 10:10:11.833 worked example now scores 0.727 / Grade B instead of the old 0.640, and `UpdateFactorWeights()` still overrides the new baseline. Verification: `verify-build.bat` passed with 514/514 tests (425 Core, 79 Integration, 10 Performance); `dotnet test tests\NT8.Core.Tests\NT8.Core.Tests.csproj --configuration Release --no-build --verbosity minimal` passed 425/425; `deployment\deploy-to-nt8.bat` completed with backup `20260823_135331` and noted `NinjaTrader.Custom.dll` was not present to invalidate. - **Action Required:** Fresh Gate 3 configuration freeze/baseline is required before collecting gate evidence after this scoring-policy change. Manual NT8 compile remains part of normal deploy hygiene, but no SIM trade is required for correctness. ### DEC-20260821-01 - **ID:** DEC-20260821-01 - **Date:** 2026-08-21 - **Status:** logged, no operator decision needed — tracking only - **Context:** Discovered while independently verifying the GAP-054 implementation (source read of `NT8StrategyBase.cs`). Two small residual items surfaced that the GAP-054 task didn't require closing but that shouldn't get lost: 1. **GAP-056 — `EnableAutoBreakeven`/`BreakevenTriggerTicks`/`BreakevenOffsetTicks` are now fully inert.** The only code path that ever read them was the runner breakeven block GAP-054 removed; there was never a separate scaler-leg breakeven implementation. All three parameters remain declared and defaulted in the strategy's NinjaTrader UI but do nothing. Not a trading-risk item — inert means harmless — but an operator setting `EnableAutoBreakeven=true` in the UI would reasonably expect it to do something. Recommended fix, low priority: either mark the parameters `[Browsable(false)]`/update their `Description` attributes to state they're currently unused, or remove them outright in a later cleanup pass. 2. **GAP-057 — no test seam exposes NinjaScript's `SetStopLoss`/`SetTrailStop` managed-order calls.** `TASK_GAP054_RUNNER_TRAIL_PROMPT.md` asked for a regression test asserting no `SetStopLoss` call is issued after `SetTrailStop` for a runner signal, with instructions to propose the smallest seam if none exists. Kilocode correctly did not fabricate coverage, but a concrete seam proposal wasn't written up. This is the same defect class as GAP-054 (silent exit-order clobbering) — worth closing so a future change to this block gets real regression coverage instead of relying on manual source review, as this review just did. - **Decision:** Track both, do not action either as part of GAP-054. No operator decision required to log them. - **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `TASK_GAP054_RUNNER_TRAIL_PROMPT.md` - **Action Required:** None immediate. Stage as low-priority follow-up prompts when convenient. ### DEC-20260819-01 - **ID:** DEC-20260819-01 - **Date:** 2026-08-19 - **Status:** accepted - **Context:** DEC-20260818-19 resolved the MaxTradeRisk/MaxStopTicks collision by moving the traded instrument from NQ to MNQ. This is a materially larger change than the other five items staged 2026-08-18: it changes `ConfigHash`, invalidates every settings/provenance export and gate-run comparison made under NQ, and interacts with the roadmap's Stage 2 instrument sequencing (Section 9.5, P2-0, already documented in the v7.0 master document as a future step — this decision brings it forward rather than introducing it new). Layering an instrument cutover on top of unvalidated defect fixes (GAP-054, GAP-045/046, GAP-055) would make it impossible to tell, if something went wrong, whether the cause was a code defect or the instrument switch. - **Decision:** Sequence the MNQ cutover as its own final step, after — not concurrent with — the code-level fixes: 1. Land and validate GAP-048, GAP-047 (Part 1), GAP-054, GAP-045/046 (Parts 1-3), GAP-055 on the current NQ configuration, in SIM/replay, per each task's own validation section. 2. Only once all of the above pass validation, execute the MNQ instrument cutover: confirm MNQ is present in both hardcoded tick-value tables (GAP-052 — `BasicRiskManager.GetTickValue` and `BasicPositionSizer.GetTickValue`), reconfigure the strategy instance to MNQ, and re-tune `MaxTradeRisk`/`MaxStopTicks`/`MaxContracts` for MNQ's $0.50/tick economics rather than leaving NQ-era values in place unexamined. 3. Run `preflight.ps1 --freeze` and produce a new `DEC-GATE3-CONFIG` for the MNQ configuration before any gate-run evidence is collected on it. Prior NQ-based gate evidence remains valid for its own record but is not comparable to post-cutover results. - **Consequences:** Adds a discrete cutover step to the roadmap rather than folding it into GAP-045/046; keeps defect-fix validation and instrument-change validation from being confounded. Historical Strategy Analyzer/backtest results tied to NQ tick economics are not directly comparable post-cutover. - **Related Files:** `docs/00-governance/decisions.md`, `docs/00-governance/roadmap.md`, `TASK_GAP045_GAP046_RISK_GUARDS_PROMPT.md`, `docs/00-governance/2026-08-19-run-book.md` - **Action Required:** Execute in the order above. Flag to Claude/Mo once step 1 items are all validated so the MNQ cutover task can be staged as its own TASK_*.md prompt. ### DEC-20260818-21 - **ID:** DEC-20260818-21 - **Date:** 2026-08-18 - **Status:** **accepted** (2026-08-19) - **Operator Decision (2026-08-19):** Accepted as proposed — persist the daily trade count using the DEC-20260818-17 halt-file pattern, rehydrate at `State.Realtime`, align to the CME 18:00 ET rollover. - **Context:** `MaxDailyTrades` is enforced from `_dailyTradeCount`, a plain in-memory field in `SimpleORBStrategy.cs` (~39) zeroed at construction (~269) and on session rollover (~756, ~961). Nothing persists it across a strategy stop/start. The CME trading date 2026-08-17 (beginning 18:00 ET Sunday 08-16) took two trades under `MaxDailyTrades=1`: 08-16 19:12 (+$277.72, `session_20260816_181528.log`) and 08-17 11:04 (+$267.72, `session_20260817_110049.log`), in two different NT8 sessions. NT8 itself treated them as one trading day — the first `PNL_UPDATE` of the 11:04 trade reads `DayPnL=$271.96` (the prior trade's $277.72 less the $5.76 entry commission) and the session closes at `DayPnL=$545.44`. This is the same class as the 7/28 breach that contributed to voiding Gate Run #2 (HIST-45) and is NOT closed by GAP-032, which fixed the within-session position-flat reset only. - **Decision:** Persist `{trading_date, daily_trade_count, account, strategy_name, symbol}` to `{LogDirectory}/daily_trade_count__.json` on each increment, and rehydrate at `State.Realtime` entry when the persisted trading date matches. Reuse the persistence pattern already established for the Conservative trailing-drawdown halt file (DEC-20260818-17) rather than inventing a second mechanism. Align the trading-date boundary with the CME session rollover (18:00 ET) rather than the calendar date, using `SessionManager` or NT8's own session date if either already exposes it. Strategy Analyzer/backtest (`Account == null`) must neither read nor write the file so backtest behaviour is byte-for-byte unchanged. - **Consequences:** Gate discipline explicitly contemplates restarts (recompiles, workspace changes, connection recovery), so without this a gate run under `MaxDailyTrades=1` cannot guarantee its own cap and its sample is uninterpretable in the same way the previous two were. Adds a small file-I/O dependency to the realtime path; a missing or corrupt file must degrade to count-zero plus a WARNING, never an exception. - **Related Files:** `src/NT8.Strategies/Examples/SimpleORBStrategy.cs`, `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `TASK_GAP055_MAXDAILYTRADES_PERSIST_PROMPT.md`, `docs/00-governance/decisions.md` - **Action Required:** Accepted. Execute `TASK_GAP055_MAXDAILYTRADES_PERSIST_PROMPT.md`; then verify by taking one SIM trade, restarting the strategy the same trading day, and confirming the next signal is rejected with `REJECT: reason=MaxDailyTrades`. ### DEC-20260818-20 - **ID:** DEC-20260818-20 - **Date:** 2026-08-18 - **Status:** **accepted** (2026-08-19) - **Operator Decision (2026-08-19):** Taxonomy split approved as proposed — no changes to the vocabulary list. - **Context:** Three of the nine reject reasons in production are overloaded. `KillSwitch` is emitted by four distinct paths in `NT8StrategyBase.cs` — the actual kill switch (~721), a portfolio-risk block (~1970), a Tier 1 per-strategy risk rejection (~2000) and a circuit-breaker open (~2055). `GradeFilter` is emitted by four paths across `NT8StrategyBase.cs` (~1979, ~1986, ~2020) and `SimpleORBStrategy.cs` (~613/~622, ~650). `TrailingDrawdownBreach` covers both a genuine breach and an unconfigured monitor. `REJECT SUMMARY` aggregates on `reason`, and `LogRejectRateLimited()` emits the disambiguating `detail` line only on the first occurrence per reason, so the aggregate counts are the only thing an operator or the dashboard sees. Demonstrated: `session_20260817_082103.log` logged `reason=KillSwitch count=647` from a real kill switch, and `session_20260818_071117.log` logged `reason=KillSwitch count=5` from a `MaxTradeRisk` rejection. This directly defeats the purpose GAP-035 was built for. - **Decision:** Split the reject vocabulary into distinct reasons — `KillSwitch`, `PortfolioRisk`, `MaxTradeRisk`, `CircuitBreaker`, `LongTradesDisabled`, `ShortTradesDisabled`, `SizeBelowMinContracts`, `RegimeVeto`, `GradeFilter` (genuine grade rejection only), `TrailingDrawdownBreach` (real breach only) and `TrailingDrawdownNotConfigured`. Logging only: no guard condition, ordering or outcome may change, and the `REJECT:` / `REJECT SUMMARY:` line formats must remain byte-identical apart from the `reason=` token. The `HistoricalReplayCatchup` exemption inside `LogRejectRateLimited()` (DEC-20260818-08) is preserved. - **Consequences:** The reason vocabulary becomes a contract for `tools/dashboard/parsers.py`, `tools/logtriage/logtriage.py` and `tools/logwatch/logwatch.py`; those parsers are believed reason-agnostic and must be read to confirm it rather than assumed. Splitting reasons slightly increases `REJECT:` detail-line volume, since rate limiting is per unique reason. `OrbRangeNotEstablished` retains its three sub-states under one reason for now — they are already distinguishable in `detail` and this is lower priority. - **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `src/NT8.Strategies/Examples/SimpleORBStrategy.cs`, `tools/dashboard/parsers.py`, `tools/logtriage/logtriage.py`, `tools/logwatch/logwatch.py`, `TASK_GAP048_REJECT_TAXONOMY_PROMPT.md` - **Action Required:** Confirmed. Execute `TASK_GAP048_REJECT_TAXONOMY_PROMPT.md`. ### DEC-20260818-19 - **ID:** DEC-20260818-19 - **Date:** 2026-08-18 - **Status:** **accepted** (2026-08-19). Both decisions made. - **Operator Decision (2026-08-19):** Decision 1 → **(c) move to MNQ.** Decision 2 → **per-position (total), not per-contract.** MaxTradeRisk is now the ceiling on total single-trade dollar risk across all contracts in the position, not a per-contract stop-distance ceiling. - **Consequence of Decision 2 for the Tier 1 check:** the ordering change flagged as "must not be made without an approved decision" in the original entry is now approved. `BasicRiskManager`'s Tier 1 check must move to after `BasicPositionSizer` determines quantity (or take an estimated/candidate quantity) so that `StopTicks × tickValue × Qty ≤ MaxTradeRisk` is the actual enforced inequality, replacing today's `StopTicks × tickValue ≤ MaxTradeRisk` with no `Qty` term. - **Consequence of Decision 2 for Part 1 Assertion D (TASK_GAP045_GAP046):** under per-contract semantics the original assertion was `MaxTradeRisk × MaxContracts ≤ DailyLossLimit`, reflecting a worst case scaled by contract count. Under per-position semantics, `MaxTradeRisk` already *is* the worst-case single-trade dollar loss regardless of contract count, so the correct assertion is `MaxTradeRisk ≤ DailyLossLimit` (a single trade must not be able to consume the whole daily loss limit on its own). This is a strictly tighter, simpler, and safer bound than the one it replaces — worst-case single-trade risk drops from the previously undefined-in-practice $600 to whatever `MaxTradeRisk` is explicitly set to. - **Sequencing (see DEC-20260819-01 below):** the risk-guard code changes (Parts 1–3 of `TASK_GAP045_GAP046_RISK_GUARDS_PROMPT.md`) are instrument-agnostic and should land and be validated on the current NQ configuration first. The MNQ instrument cutover itself is a separate, subsequent deployment step — see DEC-20260819-01. - **Context (original):** Two independent live outages on 2026-08-18 traced to parameter pairs that are individually valid and jointly impossible. (1) `BasicRiskManager.CalculateTradeRisk()` returns `intent.StopTicks * tickValue` with no quantity term, evaluated before sizing. On NQ at $5.00/tick, `MaxTradeRisk=$200` caps the stop at 40 ticks while `MaxStopTicks=50` (=$250) is configured, so the top 20% of the ATR stop range is unreachable. `session_20260818_071117.log` at 10:10:24 ET: five valid `SIGNAL: Sell NQ` lines, zero submissions, `REJECT: reason=KillSwitch detail=Risk manager rejected: Trade risk too high: $225.00`. `MinContracts=1` is already the floor, so the trade was unplaceable rather than resizable. (2) Separately, the parameter's display name is "Max Trade Risk" and master document v6.4 §3.2 documents the Tier 1 formula as `(StopTicks × TickVal × Qty) > MaxTradeRisk`. The code has never had the quantity term, so worst-case position risk is `MaxTradeRisk × MaxContracts` = $600 against a $1,000 `DailyLossLimit`. - **Decision (proposed, two parts):** **Decision 1 — resolve the collision.** Choose one of: (a) `MaxTradeRisk = $250`, making `MaxStopTicks=50` reachable and raising per-contract worst case 25%; (b) `MaxStopTicks = 40`, leaving nothing unreachable but tightening the stop relative to ATR on volatile days and raising stop-out rate; (c) validate on MNQ at $0.50/tick, where 50 ticks = $25 per contract, the collision disappears entirely and sizing becomes granular enough for `MaxContracts` to do real work. **Decision 2 — define the semantics.** State explicitly whether `MaxTradeRisk` is a per-contract stop-distance ceiling (what the code does today) or a per-position risk limit (what the name and the master document imply). If per-position, the Tier 1 check must move to after sizing or take an estimated quantity — a real ordering change that must not be made without this entry being accepted first. Independently of both, add startup assertions in the GAP-003 style for: `EnableTrailingDrawdown ⇒ AccountStartingBalance > 0`; `MaxStopTicks × tickValue ≤ MaxTradeRisk`; `MinContracts ≤ MaxContracts`; and a bound relating `MaxTradeRisk × MaxContracts` to `DailyLossLimit`. - **Consequences:** Either value change alters `ConfigHash` and requires a fresh freeze capture and a new `DEC-GATE3-CONFIG`. Option (c) is a larger strategic change than a parameter edit and interacts with the roadmap's instrument sequencing; it is also the only option that removes the class of problem rather than an instance of it. Until Decision 2 is answered, the system's true worst-case single-trade loss is undefined in the documentation and under-enforced in the code, which is the largest open drawdown exposure in the project. - **Related Files:** `src/NT8.Core/Risk/BasicRiskManager.cs`, `src/NT8.Core/Sizing/BasicPositionSizer.cs`, `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `TASK_GAP045_GAP046_RISK_GUARDS_PROMPT.md` - **Action Required:** Both decisions made — see above. Execute `TASK_GAP045_GAP046_RISK_GUARDS_PROMPT.md` in full (Part 3 is now unblocked) on the current NQ configuration. Hold the MNQ instrument cutover itself for DEC-20260819-01's sequencing. ### DEC-20260818-18 - **ID:** DEC-20260818-18 - **Date:** 2026-08-18 - **Status:** **implemented** (2026-08-21). Supersedes DEC-20260810-02 and DEC-20260815-01 on the runner question. - **Operator Decision (2026-08-19):** Accepted — stop applying auto-breakeven to the runner leg. - **Parameter-scoping sub-question resolution:** the entry left open whether `EnableAutoBreakeven` becomes runner-scoped-off by default or gains a separate `EnableRunnerBreakeven` flag. Not addressed in the 2026-08-19 acceptance message. Default resolved here rather than blocking implementation: **unconditionally skip breakeven on the runner leg in the `OnBarUpdate` block; do not add a new flag.** Rationale — a trailing stop already dominates a frozen breakeven at every point once GAP-054 is fixed, so a toggle to re-enable the strictly worse behavior adds parameter surface and testing burden without a scenario where an operator would want it. `EnableAutoBreakeven`/`BreakevenTriggerTicks`/`BreakevenOffsetTicks` continue to govern the scaler leg only, unchanged. If Mo wants the flag instead of the unconditional skip, say so and this line will be revised before Kilocode implements it. - **Context:** `SetStopLoss()` and `SetTrailStop()` are mutually exclusive per signal name in NinjaScript — the later call replaces the earlier exit order. `SubmitOrderToNT8()` (`NT8StrategyBase.cs` ~2178-2196) arms the runner correctly with `SetStopLoss` then `SetTrailStop(_runnerSignalName, Ticks, RunnerTrailTicks)` then `EnterLong/EnterShort`. But the auto-breakeven block in `OnBarUpdate()` (~797-804) then calls `SetStopLoss(_runnerSignalName, CalculationMode.Price, bePrice, false)`, replacing the live trail with a static stop at entry + `BreakevenOffsetTicks`. The runner never trails again. All four broker-confirmed trades log it: `BREAKEVEN runner stop -> ... profit=28/25/24/26 ticks`, at which points a 12-tick trail would have sat at +16/+13/+12/+14 ticks while the stop was moved to +1. The breakeven action therefore moves the stop backwards, giving back 11-15 ticks of already-locked profit and freezing. Conservative floor estimate: 55 ticks (~$275 gross, ~$252 net) versus the $25 gross / $1.96 net actually realised — roughly 24% of total realised P&L. Two secondary defects sit in the same block: `entryPrice` is `Position.AveragePrice`, the blended average across both legs rather than the runner's own fill (on 2026-08-16 producing the off-tick breakeven price 30200.08 on a 0.25-tick instrument), and `Calculate = OnBarClose` means `BreakevenTriggerTicks = 20` actually fires at 24-28 ticks. - **Decision (proposed):** Stop applying auto-breakeven to the runner leg. A trailing stop already provides monotonically improving protection and does so better than a frozen breakeven at every point. `EnableAutoBreakeven`, `BreakevenTriggerTicks` and `BreakevenOffsetTicks` remain as parameters; whether they become runner-scoped-off by default or gain a separate `EnableRunnerBreakeven` flag defaulting to false is an open sub-question for the operator. The existing prohibition on calling `SetTrailStop()` inside `OnBarUpdate` (which would reset the trail anchor to bar-close price — a real defect diagnosed 2026-04-13) stands unchanged. Before implementation, NinjaTrader's own documentation must be cited confirming the mutual-exclusivity behaviour; if it documents otherwise, the task stops and reports. - **Consequences:** This supersedes the framing in DEC-20260810-02 and DEC-20260815-01, both of which treated the runner as a parameter-placement problem and deferred or scoped a breakeven-trigger retune. The runner has in fact never been tested, so its economics are unknown rather than poor, and the earlier conclusion that it might be worth disabling was drawn from data the defect produced. **RUNNER-001 must not execute until this lands** — an 18-combination sweep over breakeven trigger × trail distance against a disabled trail would return a trail axis with no effect and a confident, meaningless recommendation. Historical Strategy Analyzer results involving the runner leg are not comparable across this change. - **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `tools/runnersweep/runnersweep.py`, `TASK_GAP054_RUNNER_TRAIL_PROMPT.md`, `docs/00-governance/decisions.md` - **Implementation Note (2026-08-21):** Implemented Option 0 in `NT8StrategyBase.cs`: `OnBarUpdate()` no longer calls `SetStopLoss()` or `SetTrailStop()` for `_runnerSignalName` after entry, and the stale runner breakeven diagnostic draw is removed. Local installed NT8 API documentation citation: `C:\Program Files\NinjaTrader 8\bin\NinjaTrader.Core.xml` documents `StrategyBase.SetStopLoss(string, CalculationMode, double, bool)` as tying the stop-loss exit to `fromEntrySignal`, and `StrategyBase.SetTrailStop(string, CalculationMode, double, bool)` as tying the trail-stop exit to `fromEntrySignal` with trail stops amended tick-by-tick. The implementation preserves the single entry-time `SetTrailStop()` call so NT8 owns the live runner trail. Verified 511/511 (`verify-build.bat`) and 422/422 (`NT8.Core.Tests`) passing, `deploy-to-nt8.bat` succeeded, deployed source hash confirmed matching the repo. - **Independent source verification (Claude, 2026-08-21):** Read the post-change `OnBarUpdate()` block directly (not just the report) — confirms no `SetStopLoss`/`SetTrailStop` call remains for `_runnerSignalName`, the block is now a comment-only no-op, and the `BREAKEVEN runner stop ->` `FileLog` line is gone (not merely the chart draw object). **Correction to this entry's own "Parameter-scoping sub-question resolution" line above:** it stated `EnableAutoBreakeven`/`BreakevenTriggerTicks`/`BreakevenOffsetTicks` "continue to govern the scaler leg only, unchanged." Source inspection shows this was never true — the original breakeven block only ever acted on `_runnerSignalName`; there was no separate scaler-leg breakeven path in the pre-fix code for it to have governed. All three parameters are declared, defaulted (`EnableAutoBreakeven=true`, `BreakevenTriggerTicks=20`, `BreakevenOffsetTicks=1`), and referenced once in a settings-export/log line — but are now fully inert with no functional effect anywhere. This is functionally fine (matches the intended zero-breakeven outcome) but is a stale-parameter hygiene issue, not a scaler-leg regression. Tracked as GAP-056 below rather than left as a silent contradiction in this entry. - **Action Required:** Deployed on 2026-08-21, not yet committed ("commits require explicit request" — operator to decide, see current_status.md). Manually compile NinjaScript, then validate on SIM/replay — NOT the live frozen account — that no `BREAKEVEN runner stop ->` line appears and the runner exits materially above entry + 1 tick before this is eligible for a live gate run. **This validation has not yet happened — GAP-054 still blocks RUNNER-001 until it does.** ### DEC-20260818-17 - **ID:** DEC-20260818-17 - **Date:** 2026-08-18 - **Status:** accepted - **Context:** Funded-prop trailing drawdown risk must be tracked at the account level, not by strategy name. `PortfolioRiskManager` is intentionally not reused as the model because it is currently keyed by strategy name only, which is GAP-042 and would silently let two strategies on one account each maintain a separate drawdown buffer. - **Decision:** Add an account-keyed `TrailingDrawdownMonitor` inside `NT8StrategyBase` with one shared high-water/lock/breach state per `Account.Name`. Equity is read with `Account.Get(AccountItem.NetLiquidation, Currency.UsDollar)`; installed NT8 API metadata confirms `AccountItem.NetLiquidation` exists and labels it as Net liquidation, with separate `CashValue`, `RealizedProfitLoss`, and `UnrealizedProfitLoss` account items. Runtime SIM validation must still cross-check this value against NT8 account display with an open position. Formula: update `currentPeak = max(currentPeak, equity)`. If not locked and `currentPeak >= AccountStartingBalance + TrailingDrawdownLockOffset`, set `locked=true` and `lockedPeakValue=currentPeak`. Reference point is `locked ? lockedPeakValue : currentPeak`; halt threshold is `referencePoint - TrailingDrawdownHaltBuffer`. If `equity <= haltThreshold`, set account breach state, flatten registered strategies for that account with `ExitLong("TrailingDrawdownHalt")` and `ExitShort("TrailingDrawdownHalt")`, log `TRAILING_DRAWDOWN_BREACH: Account= Equity= Peak= Floor= Locked= Time=`, and block new entries with reject reason `TrailingDrawdownBreach` for the rest of the session. - **Consequences:** The monitor is fully opt-in via `EnableTrailingDrawdown=false` default, so existing gate-validation sessions are inert unless explicitly enabled. Multiple strategy instances sharing one account name share one drawdown floor and breach state. Conservative-tier breaches write `{LogDirectory}/drawdown_halt_.json`; startup with that file present enters halted state until the operator manually deletes it. Normal/Aggressive breaches are in-memory only and clear on restart. This task deliberately does not implement EOD/Option-2 mode or Python/Apprise notification wiring. - **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `docs/00-governance/decisions.md` - **Action Required:** In SIM, verify `AccountItem.NetLiquidation` includes unrealized P&L by comparing logged equity with NT8 account display while a position is open; test breach flattening, persisted Conservative halt, restart behavior by tier, lock-in floor behavior, disabled-mode inertness, and two-strategy shared account state. ### DEC-20260818-16 - **ID:** DEC-20260818-16 - **Date:** 2026-08-18 - **Status:** accepted - **Context:** The operator trades both a funded prop account with strict trailing drawdown rules and a small personal/micro account that should become eligible for a different risk posture as capital grows. One static risk posture cannot accurately represent both accounts. - **Decision:** Add a manual `RiskTier` NinjaScript setting with `Conservative`, `Normal`, and `Aggressive`, defaulting to `Normal`. Add `MicroUpgradeThreshold` defaulting to `5000`; each realtime bar reads account balance via `Account.Get(AccountItem.CashValue, Currency.UsDollar)` and, once per strategy session, logs/prints `TIER_UPGRADE_SUGGESTED: Balance= crossed threshold=; review RiskTier setting.` when crossed. The strategy never changes `RiskTier` automatically. - **Consequences:** Risk posture becomes explicit in strategy settings and provenance without creating hidden automatic tier changes. The upgrade threshold is advisory only and safe for live use because it cannot alter sizing, risk validation, order submission, or drawdown halt behavior. - **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `docs/00-governance/decisions.md` - **Action Required:** Confirm in SIM that threshold crossing logs exactly once and does not change `RiskTier` or any order behavior. ### DEC-20260818-15 - **ID:** DEC-20260818-15 - **Date:** 2026-08-18 - **Status:** accepted - **Context:** The dashboard console only showed rejection/risk visibility from the live raw-log tail, so a meaningful `REJECT:` could scroll out and disappear from operator view even though the full session file still contained durable `REJECT SUMMARY:` and `REJECT:` records. The same dashboard also lacked signal-vs-fill visibility and had no approximation for good telemetry setups that could not become trades because a session-level block had already appeared. Today's 10:10 `SIGNAL` followed by `KillSwitch`/MaxTradeRisk rejection in `session_20260818_071117.log` made the gap concrete. - **Decision:** Add read-only dashboard KPIs sourced from the full current `session_*.log` file on every `/api/state` poll: `session_reject_totals`, `signal_outcomes`, `signal_grade_summary`, `missed_grade_b_plus_count`, and capped `missed_grade_b_plus_samples`. The full-file read per poll is an accepted dashboard observability trade-off and should not be over-engineered with caching unless it is measured as slow. Signal-vs-fill correlation treats a `FILL` before the next `SIGNAL` as filled and captures the following `REJECT:` reason when present. Older `SIGNAL: Sell NQ | LIVE MODE` lines without inline grade/score use the latest prior `STATE:` grade/score so current logs remain analyzable. - **Consequences:** Risk/reject counts are persistent for the full session and no longer disappear when raw-tail lines scroll out. Signal outcomes make rejected/unfilled generated signals visible by grade. Missed B+ setup counting is explicitly approximate: it infers blocked opportunity from `STATE:` samples after blocking `REJECT:` reasons (`RthGuard`, `MaxDailyTrades`, `KillSwitch`, `CmeHoliday`) have appeared, not from a first-class signal-quality-vs-execution-outcome model. Revisit this metric once the pending MaxDailyTrades architecture decision discussed in today's DEC-20260818-14 follow-up session is implemented, because that design should make the distinction exact rather than inferred. This remains observability-only and cannot affect live trading behavior because it only reads log files under `tools/dashboard`. - **Related Files:** `tools/dashboard/parsers.py`, `tools/dashboard/server.py`, `tools/dashboard/console.html`, `tools/dashboard/console.js`, `docs/00-governance/decisions.md` - **Action Required:** In a later live session, compare dashboard missed-setup samples against raw `STATE:` lines after any real `MaxDailyTrades` block and revise the approximation once MaxDailyTrades emits exact signal-quality/execution-outcome telemetry. ### DEC-20260818-14 - **ID:** DEC-20260818-14 - **Date:** 2026-08-18 - **Status:** accepted - **Context:** Follow-up verification for DEC-20260818-11 confirmed the `SimpleORBNT8` side of fixed-position UI consolidation is wired, not just the `NT8StrategyBase` extension point. The repo and deployed NT8 Custom source both contain `SimpleORBNT8.AppendTopLeftDiagnosticLines(List lines)` for TradeTaken/DailyTradeCount and a single `Diag_BottomLeft` block for ORBRange/BreakoutDir. - **Decision:** Treat the current `SimpleORBNT8` implementation as completion of DEC-20260818-11 rather than a new visual feature. No additional code change is required: old `Diag_TradeTaken`/`Diag_DailyCount` cleanup remains owned by the base consolidated top-left draw path, and old `Diag_ORBRange`/`Diag_BreakoutDir` cleanup remains owned by the SimpleORB bottom-left draw path before drawing `Diag_BottomLeft`. - **Consequences:** The intended fixed-position consolidation is complete in source and deployed NinjaScript source. Runtime visual validation is still required for stacked top-left and bottom-left rendering and for any collision with NT8's native strategy-parameter display. - **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `src/NT8.Adapters/Strategies/SimpleORBNT8.cs`, `docs/00-governance/decisions.md` - **Action Required:** In NT8, visually confirm the consolidated top-left and bottom-left blocks render without overlap under simultaneous active conditions. ### DEC-20260818-13 - **ID:** DEC-20260818-13 - **Date:** 2026-08-18 - **Status:** accepted - **Context:** Follow-up verification for DEC-20260818-12 confirmed that event-driven telemetry's pending-breakout change detection depends on `SimpleORBNT8` overriding `GetStateTelemetryPendingBreakoutDirection()`. Without that strategy-specific override, the base implementation returns `0`, causing the intended `0 -> 1` or `0 -> -1` breakout-arm transition to be invisible to `MaybeWriteStateTelemetry()`. - **Decision:** Treat the existing `SimpleORBNT8.GetStateTelemetryPendingBreakoutDirection()` override as required completion of DEC-20260818-12 rather than a separate telemetry feature. The override reads `_sdkStrategy as SdkSimpleORB` and returns `sdkOrb.PendingBreakoutDirection` when available, otherwise `0`, matching the null-check pattern used by the neighboring telemetry overrides. - **Consequences:** Pending-breakout direction changes now have a strategy-specific data source for the event-driven `STATE:` path. Runtime validation is still required to confirm a live/SIM breakout-arm transition emits immediately and that the periodic 30-second snapshot remains unaffected. - **Related Files:** `src/NT8.Adapters/Strategies/SimpleORBNT8.cs`, `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `docs/00-governance/decisions.md` - **Action Required:** In live/SIM, force a breakout-bar/confirmation sequence and confirm a `STATE:` line appears when `PendingBreakoutDirection` changes. ### DEC-20260818-12 - **ID:** DEC-20260818-12 - **Date:** 2026-08-18 - **Status:** accepted - **Context:** The 30-second `STATE:` telemetry snapshot is useful for ambient health monitoring but can lag fast ORB breakout/confirmation transitions on primary bars that close less than 30 seconds apart. The operator needs to see entry-imminent state changes in real time without turning `STATE:` into per-bar score-noise logging. - **Decision:** `MaybeWriteStateTelemetry()` now samples on meaningful change, not only on a clock. It still preserves the existing 30-second periodic snapshot and its independent cooldown, but it also emits an immediate supplementary `STATE:`/`STATE_DETAIL:`/`STATE_CONTEXT:` set whenever either `SimpleORBNT8.PendingBreakoutDirection` changes or the telemetry grade crosses the configured `MinTradeGrade` threshold in either direction. The change-triggered emission does not reset `_lastStateTelemetryTime`, so the periodic health snapshot continues on its own cadence. This is deliberately limited to PendingBreakoutDirection and grade-threshold crossing; exact score decimal changes are ignored to avoid choppy log volume. - **Consequences:** Fast breakout arming/resetting and grade eligibility transitions should now appear in the session log immediately instead of waiting for the next 30-second snapshot. This design is distinct from the `REJECT:` rate-limiting model: `STATE:` change-triggering is about sampling dynamic state at meaningful transitions, while `REJECT:` rate limiting is about avoiding repetition of static facts. The two throttling strategies must not be conflated. - **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `src/NT8.Adapters/Strategies/SimpleORBNT8.cs`, `docs/00-governance/decisions.md` - **Action Required:** In live/SIM, force a rapid breakout-bar/confirmation sequence and confirm `STATE:` appears at the pending-direction change; run a quiet session to confirm periodic ~30s `STATE:` output remains; measure `STATE` line count during a choppy ORB window. ### DEC-20260818-11 - **ID:** DEC-20260818-11 - **Date:** 2026-08-18 - **Status:** accepted - **Context:** Multiple `Draw.TextFixed()` diagnostics shared the same fixed chart positions. NinjaScript does not auto-stack these calls, so `Diag_Regime`, `Diag_Runner`, `Diag_TradeTaken`, and `Diag_DailyCount` collided at `TextPosition.TopLeft`, while `Diag_ORBRange` and `Diag_BreakoutDir` collided at `TextPosition.BottomLeft`. This visual-only issue is independent of DEC-20260818-10's ETH refresh path, although ETH refresh made stale/colliding fixed labels more visible. - **Decision:** `NT8StrategyBase.DrawDiagnostics()` now builds a single newline-joined top-left diagnostics block and exposes `AppendTopLeftDiagnosticLines(List lines)` for derived strategies. `SimpleORBNT8` overrides that hook to append TradeTaken and DailyTradeCount under the same top-left draw call. `SimpleORBNT8.DrawDiagnostics()` now similarly builds one newline-joined bottom-left block for ORB range and breakout direction. Old separate tags are removed before the combined tags are drawn so stale chart objects do not linger. Color consolidation choice: the top-left block uses white text on a black background for mixed-status readability; the bottom-left ORB block uses white text on a dark-blue background, preserving the prior ORB range block's visual theme while accepting a single color for breakout direction. - **Consequences:** Simultaneously active diagnostic lines at the same fixed position now render as stacked text in one chart object instead of overlapping. Per-line colors are intentionally not preserved because `Draw.TextFixed()` styles the whole fixed text object. Single-occupant positions (`Diag_Session` top-right, `Diag_TestMode` center, and `Diag_Prov` bottom-right) are unchanged. Native NT8 strategy-parameter-display overlap has not been validated in this code session and still requires visual chart confirmation. - **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `src/NT8.Adapters/Strategies/SimpleORBNT8.cs`, `docs/00-governance/decisions.md` - **Action Required:** Visually verify multiple top-left and bottom-left conditions render stacked, and confirm whether NT8's native strategy-parameter display still overlaps the consolidated top-left block. ### DEC-20260818-10 - **ID:** DEC-20260818-10 - **Date:** 2026-08-18 - **Status:** accepted - **Context:** DEC-20260818-07 intentionally scoped `EnableEthTelemetry` to text telemetry only: the ETH branch called `MaybeWriteStateTelemetry()` and returned before `DrawDiagnostics()`. Live chart review showed stale RTH visual labels during ETH because `DrawDiagnostics()` had not run since a prior RTH/TestMode bar. Source review of `NT8StrategyBase.DrawDiagnostics()` and `SimpleORBNT8.DrawDiagnostics()` confirmed the methods are gated by `EnableChartDiagnostics` and use chart drawing calls only, without `_sdkStrategy.OnBar()`, `ProcessStrategyIntent()`, order submission, or trading state mutation. - **Decision:** When a bar is outside RTH, TestMode is false, and `EnableEthTelemetry` is true, the existing ETH telemetry branch now calls `DrawDiagnostics()` in the same try/catch after building read-only bar/context state and writing optional state telemetry. The branch still returns before `_sdkStrategy.OnBar()` and `ProcessStrategyIntent()`, so ETH telemetry remains visual/read-only only. - **Consequences:** With `EnableEthTelemetry=true` and `EnableChartDiagnostics=true`, the chart's session tag, ORB box, trigger lines, and breakout indicators can refresh during ETH instead of displaying stale RTH drawings. With `EnableEthTelemetry=false`, default ETH behavior remains unchanged. RTH and Strategy Analyzer paths are unchanged. - **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `src/NT8.Adapters/Strategies/SimpleORBNT8.cs`, `docs/00-governance/decisions.md` - **Action Required:** In a live ETH session, verify `SESSION: ETH` and ORB visual diagnostics refresh with `EnableEthTelemetry=true`/`EnableChartDiagnostics=true`, and verify no `SUBMIT`/`FILL` lines appear outside RTH from this path. ### DEC-20260818-09 - **ID:** DEC-20260818-09 - **Date:** 2026-08-18 - **Status:** accepted - **Context:** `ProcessStrategyIntent()` calculated position size using the static `intent.StopTicks` emitted by the SDK strategy, while `SubmitOrderToNT8()` later overwrote `intent.StopTicks` with the ATR-derived dynamic stop when `EnableDynamicStop=true`. That meant contract count was based on a stale stop distance and could diverge materially from the actual submitted stop risk. The same ordering defect affected `RecommendedContracts` telemetry because the telemetry intent used `SimpleORBNT8.StopTicks` rather than the current dynamic stop. This is distinct from DEC-20260818-08's historical-replay order-submission block. - **Decision:** Dynamic ATR stop finalization now happens before sizing. `NT8StrategyBase.ProcessStrategyIntent()` applies the existing `EnableDynamicStop && CurrentBars[0] >= AtrPeriod` formula and min/max clamping before portfolio/per-strategy risk, `_positionSizer.CalculateSize()`, and submission. `SubmitOrderToNT8()` no longer recomputes or overwrites `intent.StopTicks`; it trusts the already-finalized value. Telemetry uses the same helper before `RecommendedContracts` sizing, and `SimpleORBNT8.BuildStateTelemetryIntent()` seeds the telemetry intent with the finalized stop ticks rather than the static `StopTicks` parameter. - **Consequences:** With `EnableDynamicStop=true`, real order sizing, `SUBMIT Stop=`, and `RecommendedContracts` now reference the same stop distance. Historical Strategy Analyzer results with dynamic stop enabled are expected to change because this corrects a real contract-sizing defect. With `EnableDynamicStop=false`, the helper is a no-op and static-stop behavior is unchanged. - **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `src/NT8.Adapters/Strategies/SimpleORBNT8.cs`, `docs/00-governance/decisions.md` - **Action Required:** In NT8, compare one dynamic-stop signal end to end: dynamic stop log, `SUBMIT Stop=`, submitted contract count, and `STATE_CONTEXT RecommendedContracts` should all reflect the ATR-finalized stop. Run a Strategy Analyzer before/after comparison with `EnableDynamicStop=true` and record the expected contract-count/P&L delta. ### DEC-20260818-08 - **ID:** DEC-20260818-08 - **Date:** 2026-08-18 - **Status:** accepted - **Context:** Live/SIM strategy startup can process NT8 historical catch-up bars before `State.Realtime`. DEC-20260817-02 fixed the prior partial symptom by preventing `WriteTradeProvenance()` from writing phantom `trades_*.jsonl` rows outside realtime, but it explicitly did not alter signal generation, risk validation, sizing, or order submission. Live evidence later confirmed that historical catch-up bars from prior RTH sessions could still produce a full Intent -> Risk approved -> Sized -> Submitted -> Filled sequence because the realtime replay-age guard and `_realtimeBarSeen` guard do not run while `State == State.Historical`, and the RTH guard checks time of day without date freshness. - **Decision:** `NT8StrategyBase.ProcessStrategyIntent()` now blocks live/SIM historical replay catch-up before any portfolio risk, direction, risk-manager, sizing, or order-submission logic when `State == State.Historical && Account != null`. The reject reason is distinct: `HistoricalReplayCatchup`. Strategy Analyzer/backtest behavior remains intentionally untouched because `Account == null` during genuine `State.Historical` backtests, so simulated historical orders still flow normally there. `LogRejectRateLimited()` permits this one reason to write a `REJECT:` line even though `State` is historical, so the catch-up safety block is visible in session diagnostics. - **Consequences:** This closes the actual order-submission gap left open by DEC-20260817-02 while retaining that provenance-file gate as an independent second safety net. MaxDailyTrades and daily P&L should no longer be affected by live/SIM catch-up activity because catch-up-phase intents cannot reach submission at all. Validation still requires a live/SIM restart with catch-up history and a Strategy Analyzer regression comparison for unchanged trade count and P&L. - **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `docs/00-governance/decisions.md` - **Action Required:** Restart NT8 with the live/SIM strategy attached to an account and confirm `REJECT: reason=HistoricalReplayCatchup` appears during catch-up with zero `SUBMIT`/`FILL` until `State.Realtime` and `_realtimeBarSeen` are true; run a Strategy Analyzer backtest over the same range and confirm trade count and P&L are unchanged. ### DEC-20260818-07 - **ID:** DEC-20260818-07 - **Date:** 2026-08-18 - **Status:** accepted - **Context:** In the consolidated fix batch, the operator needed regime/factor/grade telemetry during ETH hours without touching the real `SimpleORBStrategy` entry state machine. The existing RTH guard in `NT8StrategyBase.OnBarUpdate()` returned before `MaybeWriteStateTelemetry()`, so sessions started during ETH produced no `STATE:` lines. The real strategy path must remain protected: no ETH call to `_sdkStrategy.OnBar()`, no `ProcessStrategyIntent()`, and no TestMode behavior changes. - **Decision:** Added opt-in `EnableEthTelemetry` (`false` by default) under Diagnostics. When a bar is outside RTH and TestMode is false, the existing `RthGuard` rejection still logs; if and only if `EnableEthTelemetry` is true, `NT8StrategyBase` builds `BarData`/`StrategyContext` from current read-only adapter state, calls `MaybeWriteStateTelemetry()`, then returns immediately. This path does not call `DrawDiagnostics()`, `_sdkStrategy.OnBar()`, or `ProcessStrategyIntent()`. - **Consequences:** Default ETH behavior remains unchanged. Operators can opt into `STATE:`/`STATE_DETAIL:`/`STATE_CONTEXT:` during ETH at the existing telemetry throttle for diagnostics only, with no path to submit an ETH order through this feature. - **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `docs/00-governance/decisions.md` - **Action Required:** In a live ETH session, verify `EnableEthTelemetry=false` produces no ETH `STATE:` lines, `EnableEthTelemetry=true` produces state telemetry, and no `SUBMIT`/`FILL` lines appear outside RTH. ### DEC-20260818-06 - **ID:** DEC-20260818-06 - **Date:** 2026-08-18 - **Status:** accepted - **Context:** In the consolidated fix batch, real `STATE_DETAIL:` output showed daily-context factors returning "No daily bar context available" even though `SimpleORBNT8.OnBarUpdate()` already builds `DailyBarContext` every bar and stores it at `_strategyConfig.Parameters["daily_bars"]`. Root cause: real intents get this context via `SimpleORBStrategy.AttachDailyBarContext()`, but the synthetic `SimpleORBNT8.BuildStateTelemetryIntent()` created an empty metadata dictionary, and factor calculators read daily context from `intent.Metadata["daily_bars"]`. - **Decision:** `SimpleORBNT8.BuildStateTelemetryIntent()` now creates a metadata dictionary and, when `_strategyConfig.Parameters["daily_bars"]` exists, attaches that same object under `"daily_bars"` before returning the synthetic telemetry intent. It deliberately does not call `AttachDailyBarContext()` because that helper mutates trade-direction, breakout-volume, and ORB fields for real trade candidates. - **Consequences:** State telemetry factors can now use the same warmed daily context as the accepted-trade path without mutating SDK strategy state. Expected live result is real NR4/NR7 and ORB-vs-ATR reason text in `STATE_DETAIL:` once daily context is warmed, with no change to `SIGNAL`/`SUBMIT`/`FILL`/`REJECT` behavior. - **Related Files:** `src/NT8.Adapters/Strategies/SimpleORBNT8.cs`, `docs/00-governance/decisions.md` - **Action Required:** Confirm live `STATE_DETAIL:` reason strings no longer report missing daily context once the daily series is warmed. ### DEC-20260818-05 - **ID:** DEC-20260818-05 - **Date:** 2026-08-18 - **Status:** accepted - **Context:** The dashboard Data Series Detail panel exposed that `SimpleORBNT8` was loading duplicate daily bar series: `SimpleORBNT8.OnStateChange()` called `AddDataSeries(BarsPeriodType.Day, 1)` in `State.Configure`, then called `base.OnStateChange()`, whose `State.Configure` branch also added the shared daily series for TASK-06c regime SMA20/50 context. Live evidence showed `BarsArray[1]` and `BarsArray[2]` were both `DayBarsType`, `DaysToLoad=365`, `HistoricalBarsLoaded=130`. This was an existing latent bug that predated today's telemetry/dashboard work and was only made visible because the dashboard now shows the full `BarsArray` readiness detail. - **Decision:** Removed the subclass `AddDataSeries(BarsPeriodType.Day, 1)` call from `SimpleORBNT8`. The base class remains the single owner of the shared daily series, so `BarsArray[1]` keeps the same role and ordering for `SimpleORBNT8.BuildDailyBarContext()` and `NT8StrategyBase.BuildStrategyContext()` regime calculations. A source comment now notes that `NT8StrategyBase` provides the shared daily series to avoid reintroducing the duplicate. - **Consequences:** Expected live readiness is now two series total: primary bars plus one daily series, with the same daily historical count as before. NR7, ORB-vs-ATR, regime SMA20/50, signal generation, sizing, and order behavior should remain unchanged because all current consumers already read daily data from index `[1]`; the removed `[2]` series had no intended consumer. - **Related Files:** `src/NT8.Adapters/Strategies/SimpleORBNT8.cs`, `docs/00-governance/decisions.md` - **Action Required:** After deploy and NT8 compile, confirm the Historical readiness block/dashboard Data Series Detail reports only primary plus one daily series and that daily bar count remains unchanged. ### DEC-20260818-04 - **ID:** DEC-20260818-04 - **Date:** 2026-08-18 - **Status:** accepted - **Context:** DEC-20260818-02/03 added `STATE_CONTEXT:` (ORB high/low/window from `SimpleORBNT8`, plus the universal `RecommendedContracts` field from `NT8StrategyBase`) but left dashboard parsing for a separate task, and verification against the actual deployed source (`NT8StrategyBase.cs`, `SimpleORBNT8.cs`) confirmed the format matched exactly what was documented. - **Decision:** Added `STATE_CONTEXT_RE`/`parse_state_context_fields()` to `parsers.py` (plain space-separated `Key=Value` tokens, deliberately generic rather than ORB-specific since the field set is strategy-extensible per the `GetStateTelemetryContextFields()` extension point). `server.py._apply_event()` stores the result at `live_state.state_context`. `console.html`/`console.js`: a new ORB range block renders `OrbHigh`/`OrbLow`/window under Strategy Status's Session Filter section (with an honest "not yet established" empty state), and the State Telemetry stat-grid gains a fifth `Recommended Contracts` stat sourced live from `state_context.RecommendedContracts` when present — distinct from the existing post-trade `last_submit.fields` sizing block, since this one updates continuously at the telemetry cadence rather than only after a real SUBMIT. - **Consequences:** Closes the loop on both DEC-20260818-02 and DEC-20260818-03's deferred dashboard work in one pass. Not yet executed against a live payload, since Claude has no code-execution access on the operator's machine — verify via `/api/state` or the console page once a session with an established ORB range is running. - **Related Files:** `tools/dashboard/parsers.py`, `tools/dashboard/server.py`, `tools/dashboard/console.html`, `tools/dashboard/console.js`, `docs/00-governance/decisions.md` - **Action Required:** Confirm `live_state.state_context` populates with `OrbHigh`/`OrbLow`/`OrbWindowStart`/`OrbWindowEnd`/`OrbReady`/`RecommendedContracts` once the ORB range establishes in a live session, and that the dashboard's ORB Range block and Recommended Contracts stat render correctly. ### DEC-20260818-03 - **ID:** DEC-20260818-03 - **Date:** 2026-08-18 - **Status:** accepted - **Context:** The operator re-authorized recommended-contract telemetry after DEC-20260818-01 clarified that `BasicPositionSizer.CalculateSize()` has no internal mutable state a telemetry-only call could corrupt. The only side effect is logger output, which does not feed back into sizing/order behavior and is limited by the existing 30-second state telemetry throttle. - **Decision:** `MaybeWriteStateTelemetry()` now calls `_positionSizer.CalculateSize(telemetryIntent, context, _sizingConfig)` after computing the confluence score, only inside the existing `EnableStateTelemetry && EnableFileLogging && State == State.Realtime` and 30-second throttle gates. The resulting `SizingResult.Contracts` is logged only, never stored or used for order submission. Because DEC-20260818-02 already introduced `STATE_CONTEXT:`, the recommended size extends that line as `RecommendedContracts=` instead of creating another near-duplicate telemetry line. When ORB context is also ready, the full line is `STATE_CONTEXT: OrbHigh= OrbLow= OrbWindowStart= OrbWindowEnd= OrbReady= RecommendedContracts=`; before ORB readiness, `STATE_CONTEXT: RecommendedContracts=` may still be emitted. - **Consequences:** The dashboard/parser follow-up can read one context line for both strategy-specific context and display-only recommended sizing. Trustworthiness still requires live validation: when a real trade later submits under matching conditions, `RecommendedContracts` should match `SUBMIT`'s `Scaler + Runner` quantity; if not, telemetry inputs must be reconciled before presenting the value as authoritative. - **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `docs/00-governance/decisions.md` - **Action Required:** Run a live session and compare `STATE_CONTEXT RecommendedContracts=` against the next matching `SUBMIT Scaler= Runner=` total. ### DEC-20260818-02 - **ID:** DEC-20260818-02 - **Date:** 2026-08-18 - **Status:** accepted - **Context:** The operator needs the opening-range high/low and ORB window visible in text telemetry and the dashboard, but ORB fields are strategy-specific and should not become part of `NT8StrategyBase.cs`'s generic `STATE:` schema. `SimpleORBNT8.DrawDiagnostics()` already reads these values from `SimpleORBStrategy`'s public diagnostic getters, so logging them can remain read-only and aligned with chart diagnostics. - **Decision:** Added `protected virtual Dictionary GetStateTelemetryContextFields(BarData barData, StrategyContext context)` to `NT8StrategyBase`; the base implementation returns `null`. `MaybeWriteStateTelemetry()` now calls the extension point at the same throttled cadence as `STATE:`/`STATE_DETAIL:` and emits `STATE_CONTEXT: Key1=Value1 Key2=Value2 ...` only when a strategy returns non-empty fields. `SimpleORBNT8` overrides the method and returns `OrbHigh= OrbLow= OrbWindowStart= OrbWindowEnd= OrbReady=` once `sdkOrb.OpeningRangeReady` is true and `OpeningRangeHigh > OpeningRangeLow`; otherwise it returns `null` so consumers can distinguish not-ready from ready values. - **Consequences:** Future strategies can add strategy-specific state telemetry context without changing the generic `STATE:` line or hardcoding ORB concepts into the base class. The format deliberately uses unquoted space-separated key/value tokens because these values are numeric/time/boolean tokens with no internal spaces. - **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `src/NT8.Adapters/Strategies/SimpleORBNT8.cs`, `docs/00-governance/decisions.md` - **Action Required:** Parser/dashboard support for `STATE_CONTEXT:` should be added in a separate presentation/data task if these fields need UI display. ### DEC-20260818-01 - **ID:** DEC-20260818-01 - **Date:** 2026-08-18 - **Status:** accepted - **Context:** The "show recommended contract count during state telemetry" task instructed Kilocode to stop if `BasicPositionSizer.CalculateSize()` wasn't provably stateless, mirroring DEC-20260817-04's caution for `RegimeManager`/`TrendRegimeDetector`/`VolatilityRegimeDetector`. Kilocode correctly stopped, reporting `CalculateSize()` calls `_logger.LogDebug()`/`LogWarning()`, which `BasicLogger` routes to `Console.WriteLine()`, and is therefore not I/O-free. - **Decision:** Direct source read of `BasicPositionSizer.cs` confirms it has exactly one instance field (`_logger`, set once in the constructor, never written to elsewhere) and no other state. `CalculateSize()` derives its result purely from its `(intent, context, config)` parameters and returns a fresh `SizingResult` each call; there is no internal history/dictionary a telemetry-only call could seed or corrupt. This is categorically different from the `RegimeManager` case, where the disqualifying risk was a diagnostic call silently building up state (`_barHistory`, `_currentStates`, `_transitions`) that a future real caller would then see polluted. `BasicPositionSizer` has no such state; its only side effect is console text output, which does not feed back into any calculation, does not affect order behavior, and is negligible in volume at the existing 30-second telemetry throttle. The task is re-authorized: `MaybeWriteStateTelemetry()` may call `_positionSizer.CalculateSize()` for display purposes. - **Consequences:** Establishes the actual test for future "is this safe to call for telemetry" questions: state that could corrupt a future real caller disqualifies a component (as with `RegimeManager`); I/O alone, on a component with no other internal state, does not. Future prompts citing "not provably stateless" should specify which kind of impurity was found rather than treating all impurity as equally disqualifying. - **Related Files:** `src/NT8.Core/Sizing/BasicPositionSizer.cs`, `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `docs/00-governance/decisions.md` - **Action Required:** Re-run the recommended-contract-count telemetry task per the original prompt, now unblocked. ### DEC-20260817-11 - **ID:** DEC-20260817-11 - **Date:** 2026-08-17 - **Status:** accepted - **Context:** Operator raised several architecture questions after reviewing the console dashboard: whether the platform-neutral SDK goal is still real, whether 24x7 trading means switching strategies or running them concurrently, whether a control-plane UI requires an NT8 AddOn, and flagged that multi-account/multi-timeframe support aren't yet real. Each was answered by direct source reading rather than recollection (`NT8.Core` file contents confirmed no `NinjaTrader.*` references; `PortfolioRiskManager.cs` read in full to confirm its concurrent-strategy design and its lack of an account key). - **Decision:** Recorded findings in `docs/00-governance/architecture.md`: a Platform-Neutral SDK Invariant section (with an explicit rule against `NT8.Core` gaining NinjaTrader references), a Multi-Strategy / 24x7 Trading Architecture section confirming the "shared everything but entry" pattern is already real and that `PortfolioRiskManager` was already built for concurrent strategies, and a Control Plane section presenting the external-command-channel alternative to an NT8 AddOn. Added `GAP-042` (no account dimension in `PortfolioRiskManager`) to Sprint 4 in `roadmap.md`, and added multi-timeframe regime alignment as an unscoped Sprint 6 idea, both cross-referenced back to `architecture.md`. - **Consequences:** These answers are now durable repo state rather than only having existed in a chat response. Future sessions asking the same architecture questions can be pointed at `architecture.md` directly. `GAP-042` must be resolved before Sprint 4's multi-strategy plans extend to multiple accounts. - **Related Files:** `docs/00-governance/architecture.md`, `docs/00-governance/roadmap.md`, `docs/00-governance/decisions.md` - **Action Required:** None in code now. `GAP-042` implementation and the multi-timeframe regime design pass are both unscoped future work, not queued into an active sprint. ### DEC-20260817-10 - **ID:** DEC-20260817-10 - **Date:** 2026-08-17 - **Status:** accepted - **Context:** DEC-20260817-09 added `STATE_DETAIL:`/`SIGNAL_DETAIL:` log lines and appended sizing-rationale fields to `SUBMIT`, but explicitly left dashboard/logtriage parser updates for a separate task. Console.js's Confluences and Factor Breakdown panels had no way to surface the human-readable factor reasons (e.g. NR4/NR7 determination, ORB-vs-ATR ratio) the operator specifically asked for, and the R:R panel had no live per-trade sizing data, only static config. Also found and removed dead code predating this session's changes: `parsers.py` had two `STATE_RE` definitions (the second silently overwrote the first), which left an entire `state = STATE_RE.search(message)` branch in `parse_session_event()` permanently unreachable since the newer regex's branch, positioned earlier in the function, always matched and returned first. - **Decision:** Added `parse_quoted_reasons()` (reverses `EscapeLogValue()`'s backslash/quote escaping) and `STATE_DETAIL_RE`/`SIGNAL_DETAIL_RE` to `parsers.py`; `parse_session_event()` now returns `type: "STATE_DETAIL"`/`"SIGNAL_DETAIL"` events with a `reasons` dict keyed by factor name. Added `parse_submit_fields()` (numeric coercion for `BaseTarget`/`DynamicTarget`/`GradeMult`/`ModeMult`/`CombinedMult`, leaving `"N/A"` as a string so it's distinguishable from `0`) and enriched the existing `SUBMIT` event with a `fields` dict. `server.py._apply_event()` stores these at `live_state.state_telemetry_reasons`, `live_state.last_signal_reasons`, and within `live_state.last_submit.fields`. `console.html`/`console.js`: Confluences and Factor Breakdown rows now carry a `title` tooltip from `state_telemetry_reasons[name]` when available; a new "Live Sizing" block under the static R:R panel renders `last_submit.fields` once a trade has submitted this session, with an honest "no trade submitted yet" empty state otherwise. - **Consequences:** This closes the loop DEC-20260817-09 left open — factor reasons and per-trade sizing rationale now reach the dashboard, not just the session log. Parsing logic was verified by hand-tracing the documented formats against `DEC-20260817-09`'s exact line specifications (quoted-value escaping, unquoted `SUBMIT` fields with `N/A` fallback) but not executed, since Claude has no code-execution access on the operator's machine, and the underlying `NT8StrategyBase.cs` change has not yet been redeployed (blocked on `NT8.Core.dll` file lock — NinjaTrader must fully close before `deploy-to-nt8.bat` can succeed). The dead `STATE_RE` shadow bug predated this session's own DASH-002 work but was only now discovered and removed. - **Related Files:** `tools/dashboard/parsers.py`, `tools/dashboard/server.py`, `tools/dashboard/console.html`, `tools/dashboard/console.js`, `docs/00-governance/decisions.md` - **Action Required:** Once NT8.Core.dll is unlocked and the telemetry enrichment redeploys/recompiles cleanly, confirm via `/api/state` (or the console page) that `state_telemetry_reasons`, `last_signal_reasons`, and `last_submit.fields` populate with real values, and that tooltips render correctly on hover. ### DEC-20260817-09 - **ID:** DEC-20260817-09 - **Date:** 2026-08-17 - **Status:** accepted - **Context:** DASH-002 `STATE:` telemetry and accepted-trade `SIGNAL`/`SUBMIT` logging exposed scores and order shape but discarded already-computed sizing rationale and each `ConfluenceFactor.Reason`. The data already exists on `intent.Metadata` and `ConfluenceScore.Factors`; surfacing it is logging-only and must not change signal generation, sizing, risk validation, or order submission behavior. - **Decision:** Keep existing score-bearing line formats intact except for appending metadata fields to `SUBMIT`. Accepted-trade factor reasons are emitted as a separate line immediately after `SIGNAL`: `SIGNAL_DETAIL: Setup="" Trend="" Volatility="" Timing="" ExecutionQuality="" NarrowRange="" OrbRangeVsAtr="" GapDirectionAlignment="" BreakoutVolumeStrength="" PriorDayCloseStrength=""`. State telemetry factor reasons are emitted at the same cadence and immediately after `STATE`: `STATE_DETAIL: Setup="" Trend="" Volatility="" Timing="" ExecutionQuality="" NarrowRange="" OrbRangeVsAtr="" GapDirectionAlignment="" BreakoutVolumeStrength="" PriorDayCloseStrength=""`. The `SUBMIT` line appends `BaseTarget= DynamicTarget= GradeMult= ModeMult= CombinedMult=` after the existing `Mode=` field. - **Consequences:** Dashboard/logtriage parsers can add support for `SIGNAL_DETAIL`, `STATE_DETAIL`, and appended `SUBMIT` fields later without ambiguity. Existing `SIGNAL`, `Factors:`, `FILL`, `PNL_UPDATE`, and `REJECT` lines are not removed or reordered. Reason values are double-quoted with backslashes and quotes escaped because reason text may contain punctuation or semicolons. - **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `docs/00-governance/decisions.md` - **Action Required:** Update dashboard/logtriage parsers in a separate task if these detail lines need structured UI display. ### DEC-20260817-08 - **ID:** DEC-20260817-08 - **Date:** 2026-08-17 - **Status:** accepted - **Context:** DASH-002's `STATE:` telemetry line was confirmed live in `session_20260817_202803.log` (validated in a real realtime session: `STATE: Regime=Neutral Direction=Buy DirectionSource=OpeningRangeMidpoint Score=0.550 Grade=D Factors=Setup=0.50x1.00;...`), but `tools/dashboard/parsers.py`'s `parse_session_event()` had no handling for it — the dashboard's `console.html`/`console.js` plan (DASH-004) explicitly noted this as "pending DASH-002" and had no real data source yet. - **Decision:** Added `STATE_RE` and `parse_state_factors()` to `parsers.py`, following the same `Factors=name=scorexweight;...` convention already used for `GradeFilter` reject-detail parsing. `parse_session_event()` now returns a `type: "STATE"` event with `regime`, `direction`, `direction_source`, `score`, `grade`, and a structured `factors` list. `server.py._apply_event()` stores the latest one at `live_state.state_telemetry`, refreshed every poll from the session-log tail like every other live field, so it is available via `/api/state` with no additional wiring. - **Consequences:** Live regime/grade/factor data now actually reaches the dashboard rather than sitting only in the session log. Observed cadence in this test session was ~5 minutes, not the 30s floor from DEC-20260817-07, because this session's primary series is `MinuteBarsType` and `MaybeWriteStateTelemetry()` only gets a chance to fire on `OnBarUpdate()` (bar close) — on the gate's actual HFT Algo Bars primary series, cadence will sit much closer to the 30s floor. Parsing logic was hand-verified against the real log line (all six capture groups resolve correctly, including the `Grade=D` immediately followed by ` Factors=` boundary) but not executed, since Claude has no code-execution access on the operator's machine. - **Related Files:** `tools/dashboard/parsers.py`, `tools/dashboard/server.py`, `docs/00-governance/decisions.md` - **Action Required:** Confirm via a live `/api/state` poll (or the dashboard once loaded) that `live_state.state_telemetry` populates and updates roughly on the observed cadence. ### DEC-20260817-07 - **ID:** DEC-20260817-07 - **Date:** 2026-08-17 - **Status:** accepted - **Context:** DASH-002 needs continuous confluence/regime telemetry for the dashboard, but per-HFT-bar logging could create excessive session-log volume and disk I/O on the strategy thread. The implementation must remain additive observability only and must not call state-mutating regime detector methods documented in DEC-20260817-04. - **Decision:** Emit `STATE:` telemetry at most once every 30 seconds while `State == State.Realtime`, `EnableFileLogging == true`, and `EnableStateTelemetry == true`. The line records `Regime`, diagnostic `Direction`, `DirectionSource`, `Score`, `Grade`, and `Factors==x;...` using the same factor-breakdown convention consumed by dashboard GradeFilter parsing. Direction is explicit so synthetic diagnostic scoring cannot be mistaken for an accepted trade signal. - **Consequences:** Expected full RTH volume is approximately 780 lines per 6.5-hour session, plus normal session logs, which is low enough for operator diagnostics while avoiding per-bar HFT log flooding. Existing `SIGNAL`, `SUBMIT`, `FILL`, `PNL_UPDATE`, and `REJECT` lines remain unchanged. The dashboard can replace its DASH-002 placeholder with real latest-state telemetry when these lines are present. - **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `src/NT8.Adapters/Strategies/SimpleORBNT8.cs`, `tools/dashboard/parsers.py`, `tools/dashboard/server.py`, `tools/dashboard/console.html`, `tools/dashboard/console.js` - **Action Required:** Dual-deploy, manually compile all NinjaScript in NT8, and verify `STATE:` lines appear in a realtime session before relying on dashboard telemetry. ### DEC-20260713-01 - **ID:** DEC-20260713-01 - **Date:** 2026-07-13 - **Status:** accepted - **Context:** July 11 sprint executed 11 tasks from old pre-v6.1 queue (TASK-06a, TASK-06b, GAP-003/004/005/006/008/009/010/011/019) but skipped v6.1-mandated TASK-00a/00b (provenance + chart diagnostics). HEAD left broken (duplicate enum/property). Sprint 2.6 executed repair + v6.1 instrumentation in strict order. - **Decision:** Accept July 11 work as valid Sprint 2 substance; Sprint 2.6 completes v6.1 instrumentation. Next sprint = Sprint 3 (Second Strategy + MNQ). - **Consequences:** Sprint numbering aligned with v6.1. Governance artifacts now match code reality. SIM gate requires all 5 Sprint 2.6 tasks + governance reconciliation before live. - **Related Files:** `docs/00-governance/current_status.md`, `SPRINT_BOARD.md`, `KILOCODE_RUNBOOK.md`, `docs/00-governance/decisions.md`, `docs/00-governance/active_work.md`, `docs/INDEX.md`, `docs/archive/master_docs/NT8_SDK_Master_Document_v6.1_Complete.docx`, `docs/archive/master_docs/NT8_SDK_Operator_Runbook_v1.0.docx` - **Action Required:** All Sprint 2.6 governance artifacts committed. Sprint 3 queue active in KILOCODE_RUNBOOK.md. SIM gate remains blocked until governance reconciliation complete. ### DEC-20260711-03 - **ID:** DEC-20260711-03 - **Date:** 2026-07-11 - **Status:** accepted - **Context:** Without a portfolio-level heat limit, multiple strategies or multiple positions within a strategy could each risk 2-3% of account simultaneously, leading to 6-9%+ aggregate risk. Need a Tier 3.5 check that caps total open risk + new trade risk as % of account balance. - **Decision:** Added MaxHeatPct (default 3.0%) to AdvancedRiskConfig. Implemented ValidatePortfolioHeat() in AdvancedRiskManager that computes: TotalOpenRisk = Σ|exposure| from _state.ExposureBySymbol; NewTradeRisk = |intent.StopTicks × tickValue × estimatedQty|; HeatPct = (TotalOpenRisk + NewTradeRisk) / Account.Equity × 100. Called as Tier 3.5 in ValidateOrder() after correlation checks. Returns Reject with detailed metrics when exceeded. Edge cases: skips if MaxHeatPct ≤ 0 or account balance ≤ 0. Logs via _logger.LogDebug. - **Consequences:** Prevents aggregate risk blowout across strategies. Backward compatible: MaxHeatPct=0 disables. Dual-deployed to NT8 Custom\Strategies\. - **Related Files:** `src\NT8.Core\Risk\AdvancedRiskModels.cs` (MaxHeatPct in AdvancedRiskConfig), `src\NT8.Core\Risk\AdvancedRiskManager.cs` (ValidatePortfolioHeat, Tier 3.5 call) - **Action Required:** Verify in SIM — session log should show "[SDK] Heat check: X% of 3.0% limit" when heat check runs; test rejection by loading multiple strategies/positions to exceed 3% heat. ### DEC-20260711-04 - **ID:** DEC-20260711-04 - **Date:** 2026-07-11 - **Status:** accepted - **Context:** RiskPerTrade (sizing parameter) could exceed MaxTradeRisk (validation limit) silently, allowing trades that would be rejected by the risk manager. This created a configuration hazard where the sizing engine would calculate position sizes based on RiskPerTrade, only to have them rejected by MaxTradeRisk check. - **Decision:** Added RiskPerTrade property to RiskConfig (defaults to MaxTradeRisk for backward compatibility). In BasicRiskManager.ValidateOrder(), added startup assertion: if (config.RiskPerTrade > config.MaxTradeRisk) throw ArgumentException with clear message identifying both values. This fails fast at order validation time rather than silently rejecting trades. - **Consequences:** Configuration errors are caught immediately with actionable message. Backward compatible: existing configs without explicit RiskPerTrade use MaxTradeRisk value. Added 3 unit tests: > throws, == accepted, < accepted. - **Related Files:** `src\NT8.Core\Common\Models\Configuration.cs` (RiskPerTrade in RiskConfig), `src\NT8.Core\Risk\BasicRiskManager.cs` (validation in ValidateOrder), `tests\NT8.Core.Tests\Risk\BasicRiskManagerTests.cs` (3 new tests) - **Action Required:** Verify in SIM with config where RiskPerTrade > MaxTradeRisk — should throw ArgumentException with clear message. ### DEC-20260711-02 - **ID:** DEC-20260711-02 - **Date:** 2026-07-11 - **Status:** accepted - **Context:** Fixed 8-tick stop on NQ ignores market volatility. At typical ATR of 20-40 ticks, an 8-tick stop causes chronic stop-outs before the move develops. Need dynamic ATR-based stop sizing that adapts to actual market conditions. - **Decision:** Implemented ATR-based dynamic stop in NT8StrategyBase with 5 new parameters: EnableDynamicStop (default false), AtrPeriod (14), AtrMultiplier (1.5), MinStopTicks (12), MaxStopTicks (50). In SubmitOrderToNT8(), before sizing: if EnableDynamicStop and CurrentBars[0] >= AtrPeriod, compute dynStop = clamp(round(ATR[0]/TickSize × AtrMultiplier), Min, Max), override intent.StopTicks, recalculate target from R:R ratio, pass ATR to context.CustomData["current_atr"] for Factor 3 and TrailingStopManager. Added [SDK] Dynamic stop logging. - **Consequences:** Stop now scales with volatility — tighter stops in quiet markets, wider in volatile. Backward compatible: EnableDynamicStop=false preserves fixed StopTicks. Dual-deployed to NT8 Custom\Strategies\. - **Related Files:** `src\NT8.Adapters\Strategies\NT8StrategyBase.cs` (5 params, dynamic stop logic, logging) - **Action Required:** Verify in SIM with EnableDynamicStop=true — session log should show [SDK] Dynamic stop line with computed value inside 12-50t; chart stop line should sit at ATR distance, not fixed 40t. ### DEC-20260711-01 - **ID:** DEC-20260711-01 - **Date:** 2026-07-11 - **Status:** accepted - **Context:** The original runner architecture coupled position management to capital sizing via `useRunner = Qty >= 2`. This meant the runner (trailing stop leg) never activated at responsible ATR-based stops (typically Qty=1 at $200 risk with NQ ATR=20-40 ticks). The runner should be a POSITION MANAGEMENT MODE, not a quantity gate. - **Decision:** Implemented `RunnerMode` enum with four modes: Auto (resolves Mode1 when Qty≥2, Mode2 when Qty=1), Mode1DualLeg (scaler + runner), Mode2RunnerOnly (full qty on trail stop, no fixed target), Mode3ScalerOnly (full qty with fixed target, no runner), Disabled (original single-leg). Added `[NinjaScriptProperty] RunnerActivationMode` to NT8StrategyBase with default `Auto`. Replaced the hardcoded quantity check with `ResolveRunnerMode()` logic and mode-specific order submission in `SubmitOrderToNT8()`. Added `[SDK] Runner mode resolved: {Mode} (Qty={N})` logging. - **Consequences:** Runner now fires at Qty=1 with ATR-based stops, decoupling position management from sizing. Backward compatible: existing configs with `EnableRunner=true` and Qty≥2 will resolve to Mode1DualLeg automatically. Dual-deployed to NT8 Custom\Strategies\. - **Related Files:** `src\NT8.Core\Common\Models\Configuration.cs` (RunnerMode enum), `src\NT8.Adapters\Strategies\NT8StrategyBase.cs` (RunnerActivationMode property, ResolveRunnerMode(), SubmitOrderToNT8() mode logic) - **Action Required:** Verify Mode2RunnerOnly behavior in SIM with Qty=1 scenarios. ### DEC-20260711-06 - **ID:** DEC-20260711-06 - **Date:** 2026-07-11 - **Status:** accepted - **Context:** The bar-driven `_tradeTaken` re-arm in `SimpleORBStrategy.OnBar()` was unreliable — it cleared `_tradeTaken` on the next bar after a trade intent, regardless of whether the NT8 position actually closed. This could allow overlapping entries if a new breakout bar arrived before the first trade was filled or stopped out. The original decision (DEC-20260429-01) accepted this for SIM but noted it must be fixed before live. - **Decision:** 1. Added `OnPositionUpdate()` logic in `NT8StrategyBase` that detects when position goes flat (`MarketPosition.Flat` or `Quantity == 0`) and sends `clear_trade_taken` to the SDK strategy via `SetParameters()`. 2. Added `clear_trade_taken` handler in `SimpleORBStrategy.SetParameters()` that clears `_tradeTaken`, `_breakoutBarSeen`, and `_pendingBreakoutDirection` (but preserves `_dailyTradeCount`). 3. Added `EnableBarBasedRearm` parameter (default `false`) to both `NT8StrategyBase` and `SimpleORBNT8` to gate the legacy bar-driven re-arm for SIM-only mode. 4. The bar-driven re-arm in `SimpleORBStrategy.OnBar()` now only executes when `EnableBarBasedRearm == true`. - **Consequences:** Position-close re-arm is now the primary mechanism for live trading (reliable, NT8-native). Bar-driven re-arm is opt-in via `EnableBarBasedRearm=true` for SIM/backtest scenarios. Backward compatible: defaults disable bar-driven re-arm, preserving existing behavior when explicitly enabled. Dual-deployed to NT8 Custom\Strategies\. - **Related Files:** `src\NT8.Adapters\Strategies\NT8StrategyBase.cs` (EnableBarBasedRearm param, OnPositionUpdate clear_trade_taken), `src\NT8.Adapters\Strategies\SimpleORBNT8.cs` (EnableBarBasedRearm param), `src\NT8.Strategies\Examples\SimpleORBStrategy.cs` (_enableBarBasedRearm field, SetParameters handlers, gated bar-driven re-arm) - **Action Required:** Verify in SIM with EnableBarBasedRearm=false — position close should clear _tradeTaken and allow new breakout; test EnableBarBasedRearm=true for SIM comparison. ### DEC-20260711-07 - **ID:** DEC-20260711-07 - **Date:** 2026-07-11 - **Status:** accepted - **Context:** Short trades were being vetoed by the AVWAP slope check (slope > 0 = bullish regime) without a configurable parameter. This made the filter mandatory and untestable in isolation — users couldn't disable it for testing or strategies that intentionally trade counter-trend. - **Decision:** Added `EnableShortTrendFilter` parameter (default `true`) to `NT8StrategyBase`, `SimpleORBNT8`, and `SimpleORBStrategy`. In `SimpleORBStrategy.OnBar()`, the short veto logic now checks this flag: when `true`, shorts are blocked if AVWAP slope > 0; when `false`, shorts are allowed regardless of regime. Long veto in bearish regime (slope < 0) remains always enforced. The flag is passed from NT8 adapter to SDK strategy via `StrategyContext.CustomData["EnableShortTrendFilter"]`. - **Consequences:** Short trend filter is now configurable and testable. Backward compatible: default `true` preserves existing behavior. Dual-deployed to NT8 Custom\Strategies\. - **Related Files:** `src\NT8.Adapters\Strategies\NT8StrategyBase.cs` (EnableShortTrendFilter param, BuildStrategyContext), `src\NT8.Adapters\Strategies\SimpleORBNT8.cs` (EnableShortTrendFilter param + ConfigureStrategyParameters), `src\NT8.Strategies\Examples\SimpleORBStrategy.cs` (_enableShortTrendFilter field, SetParameters, OnBar gating) - **Action Required:** Verify in SIM with EnableShortTrendFilter=false — short trades should fire even in bullish regime; with EnableShortTrendFilter=true (default) — shorts blocked when AVWAP slope > 0. ### DEC-20260429-01 - **ID:** DEC-20260429-01 - **Date:** 2026-04-29 - **Status:** accepted - **Context:** `MaxDailyTrades` re-arm logic in `SimpleORBStrategy.OnBar()` clears `_tradeTaken` and resets pullback confirmation state on the *next bar after a trade intent is generated*, not when the NT8 position actually closes. This is because `SimpleORBStrategy` is a pure C# core class with no visibility into NT8 position lifecycle — it only sees bars. - **Decision:** Accept bar-based re-arm for SIM data collection phase. The daily loss limit (`DailyLossLimit`) and `MaxOpenPositions` in the NT8 adapter act as the live position guard, preventing overlapping entries from causing runaway risk in practice. - **Consequences:** In a fast market, a second trade intent could be generated while the first position is still open if the next breakout bar arrives before NT8 has filled or stopped the first trade. This is acceptable in SIM but must be addressed before live trading. The fix is to wire re-arm to a position-close callback in `NT8StrategyBase` (Sprint 3/4 concern). - **Related Files:** `src\NT8.Strategies\Examples\SimpleORBStrategy.cs`, `src\NT8.Adapters\Strategies\NT8StrategyBase.cs` - **Action Required (pre-live):** Implement position-close-driven re-arm in `NT8StrategyBase` before going live with `MaxDailyTrades > 1`. ### DEC-20260711-08 - **ID:** DEC-20260711-08 - **Date:** 2026-07-11 - **Status:** accepted - **Context:** The strategy had no awareness of CME holidays, meaning it would attempt to trade on days when the market is closed (New Year's Day, MLK Day, Presidents Day, Good Friday, Memorial Day, Independence Day, Labor Day, Thanksgiving, Christmas) or has early closes (day after Thanksgiving, Christmas Eve, New Year's Eve). This caused errors and wasted compute on non-trading days. - **Decision:** Implemented `CmeHolidayCalendar` with full CME holiday schedule including observed dates (weekend -> nearest weekday). Added `EnableCMEHolidayGuard` parameter (default `true`) to `NT8StrategyBase`, `SimpleORBNT8`, and `SimpleORBStrategy`. In `NT8StrategyBase.OnBarUpdate()`, checks `CmeHolidayCalendar.IsHoliday(Time[0].Date)` and skips bar processing. In `SimpleORBStrategy.OnBar()`, checks `CmeHolidayCalendar.ShouldSkipOrbWindow(bar.Time.Date)` and returns null. Holiday list: New Year's Day (Jan 1), MLK Jr. Day (3rd Mon Jan), Presidents Day (3rd Mon Feb), Good Friday (computed via Easter), Memorial Day (last Mon May), Independence Day (Jul 4), Labor Day (1st Mon Sep), Thanksgiving (4th Thu Nov), Christmas (Dec 25). Early-close days also tracked via `IsEarlyClose()`. - **Consequences:** Strategy now automatically skips non-trading days. Backward compatible: default `true` preserves new behavior; can disable for testing. Dual-deployed to NT8 Custom\Strategies\. - **Related Files:** `src\NT8.Core\Calendar\CmeHolidayCalendar.cs` (new), `src\NT8.Adapters\Strategies\NT8StrategyBase.cs` (EnableCMEHolidayGuard, OnBarUpdate), `src\NT8.Strategies\Examples\SimpleORBStrategy.cs` (EnableCMEHolidayGuard, OnBar), `src\NT8.Adapters\Strategies\SimpleORBNT8.cs` (EnableCMEHolidayGuard) - **Action Required:** Verify in SIM — session log should show "[SDK] CME Holiday Guard: skipping bar YYYY-MM-DD (holiday)" on CME holidays; strategy should not generate signals on those days. ### DEC-20260711-09 - **ID:** DEC-20260711-09 - **Date:** 2026-07-11 - **Status:** accepted - **Context:** The runner trailing stop used a fixed `RunnerTrailTicks` (default 12-20 ticks) regardless of market volatility. In quiet markets this was too wide (giving back profits); in volatile markets too tight (premature stop-outs). Need ATR-based trailing that adapts to actual market conditions. - **Decision:** Added ATR-based trailing stop with 5 new parameters: `EnableATRTrailing` (default `false`), `ATRTrailingPeriod` (14), `ATRTrailingMultiplier` (2.0), `ATRTrailingMinTicks` (8), `ATRTrailingMaxTicks` (60). When `EnableATRTrailing=true` and `CurrentBars[0] >= ATRTrailingPeriod`, computes `trailTicks = clamp(round(ATR(Close, ATRTrailingPeriod)[0] / TickSize * ATRTrailingMultiplier), ATRTrailingMinTicks, ATRTrailingMaxTicks)` and calls `SetTrailStop` with this dynamic value instead of fixed `RunnerTrailTicks`. Added logging: `[SDK] ATR Trail: ATR={X}ticks x {Y} = {Z}ticks (clamped {Min}-{Max})`. When disabled, falls back to fixed `RunnerTrailTicks`. - **Consequences:** Trailing stop now scales with volatility — tighter in quiet markets, wider in volatile. Backward compatible: `EnableATRTrailing=false` preserves fixed tick trail. Dual-deployed to NT8 Custom\Strategies\. - **Related Files:** `src\NT8.Adapters\Strategies\NT8StrategyBase.cs` (5 params, ATR trailing logic in SubmitOrderToNT8, logging), `src\NT8.Strategies\Examples\SimpleORBStrategy.cs` (_enableAtrTrailing field, SetParameters, ATRTrailingPeriod/Multiplier/MinTicks/MaxTicks properties), `src\NT8.Adapters\Strategies\SimpleORBNT8.cs` (EnableATRTrailing, ATRTrailingPeriod/Multiplier/MinTicks/MaxTicks params + ConfigureStrategyParameters) - **Action Required:** Verify in SIM with EnableATRTrailing=true — session log should show [SDK] ATR Trail line with computed value inside 8-60t; chart trail stop should sit at ATR distance, not fixed 20t. ### DEC-20260713-01 - **ID:** DEC-20260713-01 - **Date:** 2026-07-13 - **Status:** superseded - **Context:** Sprint 2.6 (July 11) completed all 5 technical tasks (TASK-FIX-01, TASK-00a, TASK-00b, TASK-06c, GAP-024) and build/tests passed (492 tests). However, the v6.1 Master Document and Operator Runbook (dated July 13) were not committed to the repository, and Sprint artifacts (SPRINT_BOARD.md, KILOCODE_RUNBOOK.md, current_status.md) still reflected Sprint 2.6 state. Governance required reconciliation: commit v6.1 docs to repo archive, promote Sprint 4 backlog to Sprint 3 queue, rewrite sprint artifacts for Sprint 3 (Second Strategy + MNQ Prep), and log this reconciliation decision. - **Decision:** 1. Committed NT8_SDK_Master_Document_v6.1_Complete.docx and NT8_SDK_Operator_Runbook_v1.0.docx to docs/archive/master_docs/ 2. Rewrote SPRINT_BOARD.md: all 6 Sprint 2.6 tasks marked COMPLETED; Sprint 4 backlog promoted to Sprint 3 queue (TASK-06a Runner Mode, TASK-06b ATR Dynamic Stop, GAP-019 Portfolio Heat, GAP-003 RiskPerTrade Assertion, GAP-004 orbRangeTicks Fix, GAP-005 GetRiskStatus, GAP-006 Position Close Re-arm, GAP-010 Short Regime Filter, GAP-008 CME Holiday, GAP-009 ATR Trailing, GAP-011 Gitea CI, GAP-022 Scenario Tests, GAP-007 Walk-Forward Docs) 3. Rewrote KILOCODE_RUNBOOK.md for Sprint 3 (Second Strategy + MNQ Prep) with TASK-06a, GAP-013, GAP-015, GAP-014, MNQ-001, MNQ-002 as the Sprint 3 queue 4. Logged DEC-20260713-01 in decisions.md (this entry) 5. Updated current_status.md to Sprint 3 handoff state - **Consequences:** Sprint 2.6 governance fully reconciled. Sprint 3 queue defined and staged. SIM Gate remains blocked until governance reconciliation complete (now satisfied). All governance files consistent. Build and 492 tests still pass. - **Related Files:** `docs/archive/master_docs/NT8_SDK_Master_Document_v6.1_Complete.docx`, `docs/archive/master_docs/NT8_SDK_Operator_Runbook_v1.0.docx`, `SPRINT_BOARD.md`, `KILOCODE_RUNBOOK.md`, `docs/00-governance/current_status.md`, `docs/00-governance/decisions.md` - **Action Required:** Verify .\verify-build.bat ✅ | dotnet test ✅ (492 tests) | git status clean ### DEC-20260713-02 - **ID:** DEC-20260713-02 - **Date:** 2026-07-13 - **Status:** accepted - **Context:** The 2026-07-13 reconciliation (DEC-20260713-01) incorrectly re-queued 12 implemented tasks, archived master docs, and staged TASK-06a as next action. Code greps confirm all 12 tasks already implemented in code (verified by grep on ResolveRunnerMode, EnableDynamicStop, orbRangeTicks, CmeHolidayCalendar, EnableShortTrendFilter, GetRiskStatus, OnPositionUpdate, clear_trade_taken, ValidatePortfolioHeat, RiskPerTrade). - **Decision:** Restore governance to match code reality. 1. Move 12 July 11 tasks back to COMPLETED with 2026-07-11 dates in SPRINT_BOARD.md. 2. Sprint 2.7 queue = TASK-00a (reissued), GAP-024 data layer, GAP-022 scenario tests, GAP-025 diagnosis. 3. Move master docs from `docs/archive/master_docs/` → `docs/` + `docs/02-runbooks/`. 3. Overwrite NEXT_PROMPT.md with TASK-00a reissue (grep-verifiable acceptance). 4. Log this decision as DEC-20260713-02 superseding DEC-20260713-01. 5. Update current_status.md for Sprint 2.7. - **Consequences:** Sprint numbering realigned (2.7 truth reconciliation before 3). Governance artifacts now match code greps. NEXT_PROMPT.md stages TASK-00a reissue. DEC-20260713-01 superseded by this entry. - **Related Files:** `SPRINT_BOARD.md`, `KILOCODE_RUNBOOK.md`, `NEXT_PROMPT.md`, `docs/00-governance/current_status.md`, `docs/00-governance/decisions.md`, `docs/archive/master_docs/` (to be moved) - **Action Required:** Complete TASK-GOV-02 (governance reconciliation), then TASK-00a reissue. ### DEC-20260714-01 - **ID:** DEC-20260714-01 - **Date:** 2026-07-14 - **Status:** accepted - **Context:** `ComputeConfigHash()` correctly fingerprints NinjaScript parameters, but a mid-gate recompile or redeploy can change executable code while preserving every parameter value and therefore the same config hash. - **Decision:** Persist a compiled-code stamp in all gate-relevant provenance. The stamp is the running assembly version plus `ManifestModule.ModuleVersionId`; it is written to session provenance, each trade JSONL record, settings exports, and the SimpleORB strategy snapshot. Each real-time signal also writes its TestMode/LIVE MODE state to the session file log. - **Consequences:** Parameter drift and code drift are distinguishable without relying on a manually maintained git SHA. The Gate Run #2 procedure must archive both `ConfigHash` and `CodeVersion`, and it forbids dual-deploys after the configuration freeze. - **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `src/NT8.Strategies/Examples/SimpleORBStrategy.cs`, `docs/00-governance/patterns_and_antipatterns.md`, `SPRINT_BOARD.md`, `NEXT_PROMPT.md`. - **Action Required:** Deploy the cleanup source, compile it in NinjaTrader, then record `DEC-GATE2-CONFIG` before starting the gate. ### DEC-20260810-01 - **ID:** DEC-20260810-01 - **Date:** 2026-08-10 - **Status:** accepted - **Context:** Three settings exports from the same 2026-08-07 session (`settings_Simple_ORB_NT8_20260807_101520.txt`, `_101543.txt`, `_150539.txt`) show `BarsPeriod` values of "15 Minute", "5 Minute", and "13 42069" (HFT Algo Bars) respectively, yet all three carry the identical `ConfigHash` `df5ff56e6db3a332e40568849f2a2fc7a121f0d57cf228b07935278bc58c9c10`. `ComputeConfigHash()` excludes `BarsPeriod` from its input, meaning structurally different bar-type configurations are indistinguishable by hash. - **Decision:** Add `BarsPeriod` (value + unit/type) to the `ComputeConfigHash()` input. Audit all remaining settings-export fields against current hash inputs and include any other field found in the export but absent from the hash. Hash-computation-only change; trading logic must remain byte-for-byte unaffected. Kilocode prompt issued 2026-08-10, execution pending next non-armed window. - **Consequences:** Any gate run or provenance record predating this fix has unverified config-hash provenance and cannot be cited as proof of a frozen configuration on hash-match alone. Once fixed, hash changes are expected whenever `BarsPeriod` changes between exports in the same session. - **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs` (`ComputeConfigHash()`), `docs/00-governance/decisions.md` - **Action Required:** Deploy fix during a window when the gate strategy is disabled (never mid-armed-session). After deploy, export settings twice in one session with different `BarsPeriod` values and confirm `ConfigHash` differs. ### DEC-20260810-02 - **ID:** DEC-20260810-02 - **Date:** 2026-08-10 - **Status:** accepted - **Context:** Two broker-confirmed live trades (2026-08-07, 2026-08-10) on `SimSimple ORB` reconciled to the penny against `8-7_to_8-10_executions.csv`. Both were winners; both had the runner leg stopped near breakeven — contributing +1 tick (~$5) on 8/7 and exactly $0 on 8/10 — while the scaler leg produced 100% of net P&L on both days ($227.72 and $262.72 respectively). On 8/10, breakeven triggered at +25 ticks profit, only 3 ticks before the ATR-derived 28-tick target, leaving the runner effectively no room to run before being parked at breakeven and then stopped out by 1 tick of adverse slippage. - **Decision:** No change to runner logic (breakeven trigger placement, `RunnerTrailTicks`) for Gate Run #3. Sample size (n=2) is insufficient to hand-tune a live parameter; any redesign must go through the Optimization Protocol (backtest-validated via NT8 Strategy Analyzer) before deployment, not be patched into a live/armed run. - **Consequences:** Gate Run #3 continues paying commission on a 3rd (runner) contract with $0–5 demonstrated contribution to date. Revisit trigger set explicitly: after 10 gate trades (half the 20-trade minimum), review runner P&L contribution as a pattern; if still flat/negative, proceed to offline backtest redesign of breakeven trigger distance and/or trail mechanism. - **Related Files:** `docs/00-governance/decisions.md`, `NT8_SDK_Optimization_Protocol.docx`, trade records `8-7_to_8-10_executions.csv`, session logs `session_20260807_101543.log`, `session_20260810_070736.log` - **Action Required:** No code action now. At 10th gate trade, pull runner-specific P&L across all trades to date and decide: keep, disable, or queue for Optimization Protocol redesign. ### DEC-20260815-01 - **ID:** DEC-20260815-01 - **Date:** 2026-08-15 - **Status:** accepted — supersedes DEC-20260810-02 - **Context:** DEC-20260810-02 deferred all runner-logic changes to a revisit at 10 gate trades, on the reasoning that n=2 was insufficient to tune a live parameter. That reasoning assumed a valid gate run was accumulating interpretable trades. It was not. Gate Run #2 was voided, Gate Run #3 has not started, and GAP-034 means a zero-trade day cannot currently be attributed to a strategy decision versus a defect. A revisit trigger anchored to gate-trade count therefore cannot fire. Additionally, the deferral's core concern — modifying a parameter on a live armed strategy — does not apply: the strategy is disarmed and this work is pre-gate preparation. - **Decision:** Runner redesign is in scope now, during the disarmed pre-gate window. The mechanism is understood: the breakeven trigger at 20 ticks sits close to the scaler target at 16 ticks and the ATR-derived target (28 ticks observed 2026-08-10), leaving the runner no room to extend before being parked at breakeven. The 10-gate-trade revisit trigger from DEC-20260810-02 is withdrawn. Requirement retained from DEC-20260810-02: any new trigger distance must be backtest-validated via the Optimization Protocol, not hand-picked. Validation must use the 60-trading-day warm-up and Tick Replay requirements of DEC-20260814-03. - **Consequences:** Runner parameters are unfrozen until the Gate Run #3 configuration freeze, at which point the swept value is locked with the rest of the config. Gate Run #3 begins with a runner leg that has a documented empirical basis rather than an inherited default. - **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `NT8_SDK_Optimization_Protocol.docx`, `docs/00-governance/roadmap.md` - **Action Required:** Execute RUNNER-001 sweep, record the selected trigger distance and its supporting statistics in a superseding entry before `DEC-GATE3-CONFIG`. ### DEC-20260814-01 - **ID:** DEC-20260814-01 - **Date:** 2026-08-14 - **Status:** accepted - **Context:** Sessions on 2026-08-03, 08-04, and 08-13 produced zero trades on days with clear NQ breakouts, while 08-07 and 08-10 produced broker-confirmed trades. The defect is intermittent. `ProcessStrategyIntent` writes a `SIGNAL:` line to the session file log unconditionally for every realtime intent; no such line appears on the zero-trade days, proving no intent was produced and isolating the fault upstream of the execution pipeline. The four remaining candidate causes (grade filter, `MaxDailyTrades` latch, ORB range not established, RTH guard) all log exclusively via `_logger` to the NT8 Output window and never to disk, so no session log can distinguish them retrospectively. - **Decision:** Treat this as GAP-034 and block Gate Run #3 until root cause is identified. Prerequisite fix is GAP-035: route every signal-rejection reason to `FileLog` alongside `_logger` so a no-trade day is self-documenting. Do not restart the gate clock on the assumption that quiet days are normal Grade-A filtering. - **Consequences:** Gate Run #3 start date slips. All Sprint 3 completion criteria now include GAP-034 closure. Any future zero-trade day becomes diagnosable from disk without requiring the Output window to have been open at the right moment. - **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `src/NT8.Strategies/Examples/SimpleORBStrategy.cs`, `docs/00-governance/current_status.md`, `docs/00-governance/common_failures.md` - **Action Required:** Execute GAP-035, redeploy during the disarmed window, then run one session with the Output window open as a cross-check that file and Output agree. ### DEC-20260814-02 - **ID:** DEC-20260814-02 - **Date:** 2026-08-14 - **Status:** accepted - **Context:** `GetRiskMode()` reads `_strategyConfig.Parameters["risk_mode"]` while the SDK writes resolved risk mode to `candidate.Metadata["risk_mode"]`. The key is never present in `Parameters`, so every trade record serializes `risk_mode` as `"Unknown"`. This is the same defect class as GAP-031, which fixed four fields by name and did not audit the `Parameters`/`Metadata` split for other consumers. - **Decision:** Fix as GAP-036 by sourcing from `intent.Metadata` with `Parameters` retained as fallback. Additionally require that any provenance field capable of holding a sentinel value (`"Unknown"`, `0.0`, `"None"`) carry a round-trip test asserting a real value survives serialization. - **Consequences:** All trade records to date have unusable `risk_mode` provenance. Gate evidence citing risk mode must be regenerated after the fix. - **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `src/NT8.Core/Logging/TradeProvenanceSerializer.cs`, `tests/NT8.Core.Tests/Logging/TradeProvenanceSerializerTests.cs` - **Action Required:** Execute GAP-036 in the 2026-08-15 to 08-17 disarmed window. ### DEC-20260814-03 - **ID:** DEC-20260814-03 - **Date:** 2026-08-14 - **Status:** accepted - **Context:** A backtest of a day that traded live produces zero trades. In Strategy Analyzer the secondary daily series loads only from the backtest start date, so `BuildDailyBarContext` returns `Count=0` below 2 daily bars and daily-dependent confluence factors score neutral, pushing the composite below the Grade A threshold. The regime gate separately requires 50 daily bars (`CurrentBars[1] >= SmaPeriodLong`) and never arms on short backtests. Neither path raises an error, and the NR7 warm-up advisory deliberately does not block. - **Decision:** This is expected behaviour, not a defect. Backtests intended to reproduce live behaviour must set the Strategy Analyzer start date at least 60 trading days before the target day. When the primary series is non-time-based (HFT Algo Bars, range, tick, volume), Tick Replay must be enabled or bar construction will differ from live regardless of warm-up. - **Consequences:** A zero-trade backtest is not evidence that no signal existed and must not be cited as such. Prior single-day backtest results are void as comparative evidence. - **Related Files:** `src/NT8.Strategies/Examples/SimpleORBNT8.cs`, `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `docs/00-governance/common_failures.md` - **Action Required:** None in code. Fold the 60-day rule and the Tick Replay requirement into the operator runbook and the Optimization Protocol. ### DEC-20260814-04 - **ID:** DEC-20260814-04 - **Date:** 2026-08-14; accepted 2026-08-16 - **Status:** accepted - **Context:** `SimpleORBNT8.SetDefaults()` sets `EnableShortTrades = false`, commented "Long-only: short trades permanently disabled pending backtest confirmation." Live runs have taken Sell entries via workspace override. Source and runtime therefore disagree, and no gate run is reproducible from a clean checkout. Separately, `StartBehavior = AdoptAccountPosition` is an undocumented change from the last recorded state. - **Decision:** Shorts are in scope for the strategy under validation. `SimpleORBNT8.SetDefaults()` must set `EnableShortTrades = true` so a clean checkout matches live workspace usage. `StartBehavior = AdoptAccountPosition` is retained because it avoids NT8 start-up synchronization submitting or flattening during historical replay bursts before the first live bar. - **Consequences:** Direction defaults are reproducible from source, and the StartBehavior choice is explicitly documented. Workspace overrides should not be required to reproduce short-enabled gate runs. - **Related Files:** `src/NT8.Adapters/Strategies/SimpleORBNT8.cs`, `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `tests/NT8.Core.Tests/Adapters/SimpleORBNT8DefaultsTests.cs` - **Action Required:** None. ### DEC-20260816-01 - **ID:** DEC-20260816-01 - **Date:** 2026-08-16 - **Status:** accepted - **Context:** `roadmap.md`'s `Last Updated` note carried a rolling "full republish planned 2026-08-16" annotation, and the master document's Section 23.4 heartbeat rule allowed governance docs to go up to 7 days without review on a rolling clock rather than a fixed date. In practice this let a republish drift to whenever convenient; on 2026-08-16 the working tree was also found dirty enough to fail two consecutive Gate 3 freeze/verify attempts (`freeze_20260816_003543`, `freeze_20260816_003653`), with the last substantive `roadmap.md`/`current_status.md` update two days stale relative to same-day decisions (DEC-20260814-04 accepted 2026-08-16; DEC-20260815-01 not yet reflected in either doc). - **Decision:** Replace the rolling 7-day heartbeat allowance with a fixed weekly cadence: `roadmap.md` and `current_status.md` are reviewed and republished every Sunday, before every Monday–Friday gate week, permanently and without exception, whether or not anything material changed. Full process defined in `docs/02-runbooks/weekly_roadmap_cadence.md`. A recurring Sunday scheduled review is configured on the operator's Claude session scheduler to drive this; if repo/device access is unavailable at trigger time, the scheduled review drafts from the Claude Project's operational artifacts and flags what it could not verify against live repo state, rather than skipping the week. - **Consequences:** Every gate week starts with governance docs that are at most a few hours stale, not up to 7 days. The master document's Section 23.4 heartbeat language is superseded by this entry and should read as a pointer to this runbook in the next master document revision (v6.4). - **Related Files:** `docs/00-governance/roadmap.md`, `docs/00-governance/current_status.md`, `docs/02-runbooks/weekly_roadmap_cadence.md`, `docs/00-governance/decisions.md` - **Action Required:** None in code. First scheduled Sunday review configured 2026-08-16 for 2026-08-23 onward. ### DEC-20260817-01 - **ID:** DEC-20260817-01 - **Date:** 2026-08-17 - **Status:** accepted - **Context:** `WriteSessionProvenance()` and `WriteTradeProvenance()` returned silently when `LogDirectory` was blank, while `InitFileLog()` and `WriteSettingsFile()` already used the default path `Documents\NinjaTrader 8\log\nt8-sdk`. The ORB-specific `WriteSessionProvenance()` override had the same silent guard. This created a split-brain evidence state: `session_*.log` and `settings_*.txt` continued writing, but `provenance_*.json` and `trades_*.jsonl` did not. The affected period includes broker-confirmed trades from 2026-08-07, 2026-08-10, 2026-08-16, and 2026-08-17. - **Decision:** Provenance and trade JSONL writes must use the same default log directory fallback as session logs/settings whenever `LogDirectory` is blank. The fallback must be explicit in both `Print()` and `FileLog()` so this failure mode is never silent again. - **Consequences:** Gate evidence for trades since 2026-07-31 cannot rely on missing provenance/trade JSONL as proof of no trades or no submissions. Broker statements/session logs remain necessary for those sessions. Future blank `LogDirectory` configurations produce provenance and trade records at the default path with visible warnings. - **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `src/NT8.Adapters/Strategies/SimpleORBNT8.cs`, `docs/00-governance/decisions.md` - **Action Required:** Redeploy and manually NinjaScript-compile before relying on new provenance/trade JSONL artifacts. ### DEC-20260817-02 - **ID:** DEC-20260817-02 - **Date:** 2026-08-17 - **Status:** accepted - **Context:** `trades_Simple_ORB_NT8_20260817.jsonl` received 57 rows during a 14-second restart replay window (`2026-08-17T16:51:16.124Z` through `2026-08-17T16:51:30.109Z`) while broker execution grid review showed no matching activity. `OnExecutionUpdate()` and live session-log `SIGNAL`/`SUBMIT` writes are already `State.Realtime` gated, but `WriteTradeProvenance()` was called from `SubmitOrderToNT8()` without an equivalent gate. Source review also found that live-chart historical replay passes `AllowDailyTradeCountIncrement=false` when `State.Historical` and `Account != null`, so accepted historical intents do not increment `_dailyTradeCount` and `MaxDailyTrades` cannot cap the replay burst in that mode. The persisted trade JSONL has only wall-clock `timestamp_utc`; it does not include the bar's own historical timestamp, so exact per-row bar-date distribution cannot be reconstructed from the file. - **Decision:** `WriteTradeProvenance()` must return immediately unless `State == State.Realtime`. This is a provenance/data-integrity gate only and must not alter signal generation, risk validation, order submission, or entry/exit behavior. Do not change historical daily-count logic without a separate approved task because it may affect Strategy Analyzer/backtest behavior. - **Consequences:** Historical catch-up/replay can no longer append phantom trade provenance rows. Existing `trades_Simple_ORB_NT8_20260817.jsonl` is contaminated by 57 phantom rows (`49` Buy, `8` Sell; `43` `RTH_ORB`, `14` `ETH`; all quantity `3`, grade `A`) and must not be used by dashboard/logtriage as clean gate evidence. Future forensic schema work should consider adding a `bar_time` field to trade provenance so replay investigations can map rows to historical bars. - **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `docs/00-governance/decisions.md`, `C:\Users\billy\Documents\NinjaTrader 8\log\nt8-sdk\trades_Simple_ORB_NT8_20260817.jsonl` - **Action Required:** Archive the contaminated 2026-08-17 trade JSONL before the next gate attempt, redeploy with the strategy disabled, delete `NinjaTrader.Custom.dll`, compile all NinjaScript cleanly, and verify a clean session start before re-arming. ### DEC-20260817-06 - **ID:** DEC-20260817-06 - **Date:** 2026-08-17 - **Status:** accepted - **Context:** `tools/runnersweep/runnersweep.py`'s `is_runner_leg()` classified a trade row as a runner leg only if the literal words "runner" or "run" appeared in its Leg/Entry name/Exit name/Signal name fields (and excluded rows containing "scaler"/"scale"). `SubmitOrderToNT8()` in `NT8StrategyBase.cs` actually names legs `SDK_{Symbol}_R_{hex}` (runner) and `SDK_{Symbol}_S_{hex}` (scaler) — neither word appears in either name. Every combo in the 18-run sweep would therefore have been marked invalid with "missing runner-leg rows" regardless of how correctly the Strategy Analyzer backtests were run and exported, discovered before any backtest time was spent by reading `SubmitOrderToNT8()`'s signal-naming logic directly rather than assuming the tool's existing matcher was correct. - **Decision:** `is_runner_leg()` now also matches the literal `_r_`/`_s_` token from the real signal-naming convention, in addition to the original word-based matching (kept for compatibility with differently-named strategies). Verified safe: the `{hex}` suffix in `SDK_{Symbol}_R_{hex}`/`SDK_{Symbol}_S_{hex}` is a GUID-derived hex string (characters `0-9a-f` only), which cannot contain the letters `r` or `s` needed to form a false `_r_`/`_s_` match, so there is no risk of misclassifying the hex portion as a leg marker. - **Consequences:** The sweep can now correctly separate runner-leg trades from scaler-leg trades once real Strategy Analyzer exports are analyzed. This was caught before any of the 18 backtests were run, avoiding wasted analyzer time on exports the tool would have silently mis-scored. - **Related Files:** `tools/runnersweep/runnersweep.py`, `src/NT8.Adapters/Strategies/NT8StrategyBase.cs` (`SubmitOrderToNT8()`), `docs/00-governance/decisions.md` - **Action Required:** None in code beyond the fix already made. When real Strategy Analyzer exports exist, spot-check that `runner_trades`/`combined_trade_count` in the JSON output look proportionally reasonable (Mode1DualLeg splits each fill into one scaler row and one runner row) before trusting the recommendation. ### DEC-20260817-05 - **ID:** DEC-20260817-05 - **Date:** 2026-08-17 - **Status:** accepted - **Context:** DEC-20260817-03 noted that `tools/dashboard/server.py` already parsed `REJECT:`/`REJECT SUMMARY:` lines for the live current-session tail via a private `_parse_rejections()`/`_parse_key_values()` pair, but `tools/logtriage/logtriage.py`'s file-based parser had no reject handling at all — so any offline/historical `logtriage.py --json` run (the primary use case for silent-day forensics on past sessions) exposed no rejection data, and the two files carried duplicate, divergence-prone parsing logic. - **Decision:** Added `parse_key_values()` to `logtriage.py` as the canonical parser (identical marker-bounded-value approach to the original `server.py` implementation, so `detail` text containing `=` or the word "bar" parses correctly). `SessionSummary` now carries `reject_summaries`, `reject_records`, and `reject_summary_final` (last-observed count per reason), populated while parsing `session_*.log` and exposed via `to_dict()`. The `SILENT DAY` diagnostic in `build_diagnostics()` now appends a `Rejections: =, ...` breakdown (and machine-readable `reject_totals`) whenever data is available, so a silent day is self-explanatory in triage output rather than merely flagged. `server.py._build_current_rows()` no longer needs its own reject parsing — `logtriage.parse_session_file()` already supplies the fields on `row_dicts[0]` — so the duplicate `_parse_rejections()`/`_parse_key_values()` methods and the now-unused `lines` parameter on `_build_current_rows()` were removed. Field names/shapes are unchanged from what `server.py` produced before and match what `tools/dashboard/app.js` already expects (`row.reject_summaries[].{reason,count,line}`, `row.reject_records[].{reason,detail,bar,line}`), so no frontend change was needed. - **Consequences:** `logtriage.py --json` run against archived log directories now surfaces the same rejection data the live dashboard already showed for the current session, closing the gap DEC-20260817-03 flagged. There is exactly one parser for this line format going forward instead of two. Logic was verified by hand-tracing both the `REJECT:` and `REJECT SUMMARY:` lines from the real `session_20260817_125115.log` archive; it has not been executed, since Claude has no code-execution access on the operator's machine — an operator run of `python tools/logtriage/logtriage.py --json` against the archive is the next real validation step. - **Related Files:** `tools/logtriage/logtriage.py`, `tools/logtriage/README.md`, `tools/dashboard/server.py`, `docs/00-governance/decisions.md` - **Action Required:** Run `python tools/logtriage/logtriage.py "C:\Users\billy\Documents\NinjaTrader 8\log\nt8-sdk\ARCHIVE" --json` and confirm `reject_summaries`/`reject_records`/`reject_summary_final` appear on session rows with no exceptions raised; spot-check the `SILENT DAY` diagnostic message on a known silent day. ### DEC-20260817-04 - **ID:** DEC-20260817-04 - **Date:** 2026-08-17 - **Status:** accepted - **Context:** DASH-002 was blocked pending confirmation that synthetic telemetry generation does not invoke state-mutating paths in `RegimeManager`, `TrendRegimeDetector`, or `VolatilityRegimeDetector`. Direct source review of `NT8StrategyBase.cs`, `SimpleORBStrategy.cs`, and `FactorCalculators.cs` confirms these three classes are instantiated in `InitializeSdkComponents()` but never called anywhere in the live signal path. The regime/volatility values actually used for signal generation are computed independently: inline SMA20/50 math in `BuildStrategyContext()` and pure-function ATR-ratio math inside `VolatilityRegimeFactorCalculator`/`TrendAlignmentFactorCalculator`, both of which read from `context.CustomData` with no side effects. `RegimeManager.UpdateRegime()`, `TrendRegimeDetector.DetectTrend()`, and `VolatilityRegimeDetector.DetectRegime()` mutate bar history, current-regime dictionaries, and transition logs on every call, and are currently dead code. - **Decision:** DASH-002 is unblocked. Telemetry implementation must sample only from the existing side-effect-free sources (the inline regime calc in `BuildStrategyContext` and the existing `IFactorCalculator.Calculate()` pure functions) and must not call `RegimeManager.UpdateRegime()`, `TrendRegimeDetector.DetectTrend()`, or `VolatilityRegimeDetector.DetectRegime()` for periodic sampling. This constraint is now recorded in `TASK_DASH-002_PROMPT.md`. - **Consequences:** DASH-002 can proceed without risk of corrupting future use of the regime-detector classes. If a later task wires `RegimeManager`/`TrendRegimeDetector`/`VolatilityRegimeDetector` into the live decision path, it starts from genuinely empty state rather than state pre-seeded by telemetry sampling. - **Related Files:** `TASK_DASH-002_PROMPT.md`, `src/NT8.Core/Intelligence/RegimeManager.cs`, `src/NT8.Core/Intelligence/TrendRegimeDetector.cs`, `src/NT8.Core/Intelligence/VolatilityRegimeDetector.cs`, `docs/00-governance/decisions.md` - **Action Required:** None in code from this decision alone. Kilocode proceeds with DASH-002 per the updated prompt. ### DEC-20260817-03 - **ID:** DEC-20260817-03 - **Date:** 2026-08-17 - **Status:** accepted - **Context:** GAP-035 made per-reason rejection details readable by logging only the first `REJECT:` line for each unique reason. Aggregate counts were still only written by `WriteRejectSummary()` at `State.Terminated`, leaving armed live sessions without current silent-day counts until the strategy stopped. Dashboard live parsing and `logwatch.py` already understand `REJECT SUMMARY: reason= count=`, but `tools/logtriage/logtriage.py` does not currently parse these lines despite dashboard copy referring to "logtriage JSON" for silent-day summary data. - **Decision:** Keep per-detail `LogRejectRateLimited()` behavior unchanged, but write aggregate `REJECT SUMMARY` snapshots during live sessions. The cadence is first live rejection at or after 10:00 ET, then every 15 bar-minutes while live rejections continue. The summary line format remains unchanged so existing live dashboard/logwatch parsers continue to consume it. - **Consequences:** Operators can see current rejection counts during the session without flooding the log with every individual rejection. Offline `logtriage.py --json` will still not expose these summaries until a separate parser update is approved. - **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`, `tools/logwatch/logwatch.py`, `tools/dashboard/server.py`, `tools/dashboard/app.js`, `tools/logtriage/logtriage.py`, `docs/00-governance/decisions.md` - **Action Required:** Validate in a live RTH session that at least one `REJECT SUMMARY` snapshot appears before termination and that displayed counts match `_rejectCounts` at snapshot time.