# NT8-SDK MASTER DOCUMENT v9.0 — THE PROJECT BIBLE
**Version:** 9.0 (supersedes v8.0 of 2026-08-26, which superseded v7.0 of 2026-08-18)
**Date:** 2026-09-22
**Repository:** `C:\dev\nt8-sdk` — branch `cleanup/wrappers-pass2`, HEAD `186e1dd`, 44 commits unpushed
**Runtime evidence root:** `C:\Users\billy\Documents\NinjaTrader 8\log\nt8-sdk`
**Deployed artifact root:** `C:\Users\billy\Documents\NinjaTrader 8\bin\Custom` — *read for the first time in this revision*
**Prepared by:** Claude (Cowork), with direct read access to the repository, the live NinjaTrader log directory, and — new in v9.0 — the deployed NinjaScript folder
**Authority:** This document supersedes v8.0 for status, gap register, roadmap, parameters and next steps. It corrects v8.0 and v7.0 on several points of fact; those corrections are marked in place.
---
## How this revision was produced, and why that matters
Every previous revision of this document described the system by reading `C:\dev\nt8-sdk`. Every previous revision was, in one specific and consequential respect, describing a program that was not running.
This revision is the first to read `C:\Users\billy\Documents\NinjaTrader 8\bin\Custom` — the folder NinjaTrader actually compiles. Doing so took about four minutes and resolved a defect that had consumed three weeks of diagnostic effort across four weekly governance reviews, two staged Kilocode tasks and a full independent verification pass.
| Revision | Date | What it could see | What it therefore could not know |
|---|---|---|---|
| v6.4 | 2026-08-16 | Repo + logs | — |
| v7.0 | 2026-08-18 | Repo + logs | — |
| v8.0 | 2026-08-26 | Repo + logs | That the running strategy was six weeks out of date |
| **v9.0** | **2026-09-22** | **Repo + logs + deployed tree** | See §18.6 |
The governing rule is unchanged from v7.0 and is worth restating because this revision is a case study in it: **where this document asserts something, it cites the artifact. Where it suspects something it could not prove, it says so and names the test that would settle it. Nothing here was inferred from memory of a prior session.**
**No code was changed in producing this document.** Every remedy below is a recommendation for a future work session.
---
## 1. EXECUTIVE SUMMARY
### 1.1 What this system is, in one page
NT8-SDK is a NinjaTrader 8 algorithmic trading SDK built to a deliberate architectural discipline: a platform-neutral core that knows nothing about NinjaTrader, an adapter layer that bridges it to NinjaScript, and strategies that generate signals and nothing else. Risk, sizing, order management, execution quality, regime detection and confluence scoring all live in the core and are owned by the SDK, not by the strategy. The intent is that a strategy author writes signal logic and inherits a tested risk and execution stack, and that the whole thing can one day be pointed at a different broker without rewriting the interesting parts.
The code is real and substantial: 74 files and 22,209 lines in `NT8.Core`, 15 files and 5,560 lines in `NT8.Adapters`, one 1,531-line example strategy, and 562 tests. The architecture is sound and the platform-neutral invariant genuinely holds — `NT8.Core` contains no NinjaTrader references, verified by grep in this revision.
One strategy is implemented: `SimpleORBStrategy`, an opening-range breakout on NQ. It trades a 30-minute opening range, confirms breakouts with a pullback, scores each candidate against ten confluence factors, filters by grade, and manages exits through either a dual-leg scaler-plus-runner or a single runner on a trailing stop.
The operator's goal is a validated, profitable SIM record — "Gate Run #3" — before committing live capital. Gate Run #3 has never started. Four broker-confirmed trades exist in the system's entire history, from 2026-08-07 through 2026-08-17.
### 1.2 Status dashboard — as of 2026-09-22
| Area | State | Evidence |
|---|---|---|
| Core source build | ✅ | `dotnet test` succeeded as of 2026-09-08; unchanged since |
| Automated tests | ✅ | 562 `[TestMethod]` (472 Core / 80 Integration / 10 Performance) |
| Platform-neutral invariant | ✅ | Verified by grep this revision — no `NinjaTrader.*` in `NT8.Core` |
| **Deployed code matches repo** | ❌ **NO** | `SimpleORBStrategy.cs` in the NT8 compile folder is dated **2026-07-13** and is 342 lines shorter than the repo copy |
| Working tree | 🟡 dirty | 4 modified, 5 untracked — byte-identical to its 2026-09-08 state |
| Commits pushed to origin | ❌ | **44 commits ahead, zero pushed.** The only copy of this project is one laptop |
| Live strategy | ⏸️ **stopped** | No session log after `session_20260908_082122.log` (ended 19:07 ET) |
| Work in progress | ⏸️ **halted** | No commit, no file change, no task pickup since 2026-09-08 |
| **GAP-064** (silent evaluation pipeline) | ✅ **ROOT CAUSE FOUND** | This revision — §1.3 Finding 1 |
| **GAP-062** (trend_confirm direction fix) | ❌ **never actually live** | Corollary of Finding 1 — §1.3 Finding 2 |
| **GAP-054** (runner trailing stop) | 🔴 **open, genuinely** | SIM-validated 2026-09-01 and failed; ~$1,200 forgone |
| GAP-034 (original silent zero-trade) | 🔴 reopened | Same root cause as GAP-064; must not be closed as "correct filtering" |
| Gate Run #3 | ⏳ not started | Freeze `freeze_20260816_170304` is five weeks stale and predates everything |
| Governance docs | 🟡 stale | `current_status.md` 2026-08-25, `active_work.md` 2026-08-24 — four weeks |
| Weekly review cadence | 🟡 running, blind | Four consecutive runs with no repo access |
### 1.3 The six findings that matter most
#### Finding 1 — NinjaTrader has been running a 2026-07-13 copy of the strategy, and no process in this project could have detected it
This is the finding that reframes the last three months.
**Evidence.** `C:\Users\billy\Documents\NinjaTrader 8\bin\Custom\Strategies\SimpleORBStrategy.cs`, dated **2026-07-13 20:36**, 1,189 lines, 51,465 bytes. The repository copy at `src/NT8.Strategies/Examples/SimpleORBStrategy.cs` is 1,531 lines, 67,242 bytes. Greps against the deployed file:
| Symbol | Deployed (2026-07-13) | Repo |
|---|---:|---:|
| `RecordSignalRejection` | **0** | 11 |
| `signal_reject_reason` | **0** | 3 |
| `OrbRangeNotEstablished` | **0** | 3 |
| `RegimeVeto` | **0** | 2 |
| `trend_confirm_long` | **0** | 1 |
`NinjaTrader.Custom.dll` is dated 2026-08-26 10:29 — NinjaTrader compiled that stale source into the live assembly.
**Mechanism.** `deploy-to-nt8.bat` copies three DLLs into `bin\Custom` and two source files — `NT8StrategyBase.cs` and `SimpleORBNT8.cs` — into `bin\Custom\Strategies`. `SimpleORBStrategy.cs` belongs to a different project and is compiled into `NT8.Strategies.dll`; the deploy script never copies it, never backs it up, and never verifies it. But a copy of it was placed in the NinjaScript Strategies folder by hand at some point on or before 2026-07-13, and has sat there ever since, invisible to every subsequent deploy.
NinjaTrader compiles every `.cs` file in `bin\Custom` into `NinjaTrader.Custom.dll`. The orphan declares `namespace NT8.Strategies.Examples` / `public class SimpleORBStrategy : IStrategy` — the same fully-qualified type as the DLL's version. `SimpleORBNT8.cs:23` declares `using SdkSimpleORB = NT8.Strategies.Examples.SimpleORBStrategy;` and `:202` does `return new SdkSimpleORB(OpeningRangeMinutes, StdDevMultiplier);`. When a type name resolves both to a source file in the current compilation and to a type in a referenced assembly, **C# binds to the source copy, silently and without a warning**. The live strategy object has therefore been the 2026-07-13 implementation.
**Consequence.** `NT8StrategyBase.LogSignalRejectionFromContext()` (`:1504`) returns immediately unless `context.CustomData` contains `signal_reject_reason` (`:1509`). The running strategy never writes that key, because the code that writes it does not exist in the running strategy. Therefore **every strategy-side reject reason has been absent from the log since at least 2026-07-13** — not suppressed, not rate-limited, simply never generated.
That is the complete root cause of GAP-064, with no residual unknown. It explains, exactly and without remainder, every observation in three weeks of investigation:
```
session_20260908_082122.log (2026-09-08 08:21:22 → 19:07:39 ET, 12,161 lines)
SIGNAL: 0
OrbRangeNotEstablished 0
GradeFilter 0
RegimeVeto 0
MaxDailyTrades 0
STATE: 115 ← adapter-side, unaffected
RthGuard 37 ← adapter-side, unaffected
WarmupIncomplete 3 ← adapter-side, unaffected
HistoricalReplayCatchup 11,709 ← adapter-side, unaffected
```
Every reject reason that survives is emitted by `NT8StrategyBase` directly. Every reject reason that vanished travels through `context.CustomData`. The dividing line is exact.
The diagnosis is closed by one further fact: `SIGNAL:` is written unconditionally at the top of `ProcessStrategyIntent` in realtime (`:2098–2099`), before any risk, direction, sizing or grade check. Zero `SIGNAL:` lines across a full RTH day therefore proves `intent == null` on every bar — which is precisely what a strategy that generates no qualifying candidate and records no reason would produce.
Corroboration that the same binary spans the whole observation window: `ConfigHash 3c902e60350db9368c2cba5b5aaab57b32d6276662fccebf15663a665a641f67` and `CodeVersion 8.1.9.0:7a27cca81894406c863494a6cb81f749` are identical in the 2026-08-31 provenance record, the 2026-09-03 trade record and the 2026-09-08 settings export.
**Why no process caught it.** `tools/preflight/preflight.ps1` check 5 (~`510–518`) SHA-256-compares the deployed `NT8StrategyBase.cs` against the repo copy — and only that file, which was the one file that was current. `Write-DeployedSourceHashes` (~`202–222`) hashes *every* `.cs` in the Strategies folder into the freeze capture, including the orphan, and nothing ever compares those hashes to anything. The machinery to detect this existed and was pointed at the wrong file.
**Remedy.** §9.3 task **P0-A** (delete the orphan, redeploy, recompile, verify), **P0-B** (make deploy verification total, not per-file), and §15.4 test 1 (a drift check that fails on any deployed `.cs` matching no repo path). Guardrail 15, §20.
#### Finding 2 — GAP-062 was never live, and three weeks of "validation overdue" were unactionable
**Evidence.** GAP-062's fix — making `trend_confirm` direction-aware by publishing `trend_confirm_long` and `trend_confirm_short` — lives entirely in `SimpleORBStrategy.cs`. The deployed copy contains **zero occurrences** of `trend_confirm_long`.
**Mechanism.** Finding 1.
**Consequence.** `DEC-20260826-01` records GAP-062 as "implemented and deployed by operator request," and `deployment/backups/20260826_005308` confirms a deploy genuinely ran. Both are true and both are irrelevant: the deploy copied a DLL whose type was then shadowed at compile time. Every weekly review from 2026-08-30 onward carried "GAP-062 SIM before/after validation still outstanding" as an action item. It was never possible to validate, because the behaviour under test was not running. The short-side scoring asymmetry that GAP-062 was written to fix has been in force this entire time, which also means the "every real short setup caps at `Trend=0.30`" observation from `DEC-20260825-04` remains an accurate description of the *live* system today.
**Remedy.** P0-A resolves it mechanically. The SIM before/after observation in §9.4 **P1-C** then becomes meaningful for the first time.
#### Finding 3 — The strategy has been trading a configuration its own subclass did not ask for
**Evidence.** `SimpleORBNT8.OnStateChange()` calls `base.OnStateChange()` **last** (`:163`), after its own `State.SetDefaults` block. The base `SetDefaults` then reassigns every non-shadowed property the subclass just set. Confirmed against the live `settings_Simple_ORB_NT8_20260908_082122.txt` export:
| Property | ORB subclass sets | Base overwrites to | Live export |
|---|---:|---:|---|
| `RunnerTrailTicks` | 20 (`:143`) | **12** (`:507`) | `Trail=12ticks` |
| `MinTradeGrade` | 5 (`:135`) | **4** (`:499`) | `MinTradeGrade : 4` |
| `MaxOpenPositions` | 2 (`:127`) | **3** (`:485`) | `MaxOpenPositions : 3` |
| `BarsRequiredToTrade` | 50 (`:134`) | **1** (`:481`) | `BarsRequiredToTrade: 1` |
**Consequence.** Four of the strategy's stated design intentions have never taken effect. The trailing stop is 12 ticks, not 20 — which means every analysis of runner economics, including GAP-054's, has been reasoning about the wrong trail distance. `MinTradeGrade` is B, not A, so the grade filter is looser than the gate plan assumes. `BarsRequiredToTrade=1` removes a warm-up guard the subclass wanted. And `deploy-to-nt8.bat` closes by instructing the operator to *"Verify defaults: BreakevenTriggerTicks=20 RunnerTrailTicks=20 MaxContracts=3"* — a check that is unsatisfiable from source and has presumably been either skipped or mis-passed at every deploy.
**Remedy.** §9.3 **P0-C**: move `base.OnStateChange()` to the top of the subclass's `SetDefaults` branch, or move the subclass's assignments after it. Then decide, deliberately, what each of those four values should be — §5.19. A regression test asserting effective post-initialisation values, not source literals, is §15.4 test 2.
#### Finding 4 — Eight properties are silently shadowed between base and subclass
**Evidence.** `EnableBarBasedRearm`, `EnableShortTrendFilter`, `EnableCMEHolidayGuard`, `EnableATRTrailing`, `ATRTrailingPeriod`, `ATRTrailingMultiplier`, `ATRTrailingMinTicks`, `ATRTrailingMaxTicks` are each declared in both `NT8StrategyBase` and `SimpleORBNT8`, without the `new` keyword.
**Mechanism.** Each derived declaration hides the base declaration. There are two independent backing values per name. The operator sets the derived property in the NinjaTrader property grid; any base-class code reading `this.EnableATRTrailing` reads the base copy.
**Consequence.** Latent and currently mostly benign — `EnableATRTrailing` is `False` on both sides and the ATR-trailing path is not in use. It becomes a live defect the moment anyone enables ATR trailing, or changes a short-trend-filter or holiday-guard setting and observes no effect. The C# compiler emits CS0108 for exactly this and the warning has been ignored.
**Remedy.** §9.4 **P1-D**: delete the duplicate declarations from the subclass. Treat CS0108 as an error going forward.
#### Finding 5 — GAP-054 is genuinely open, and is not explained by Finding 1
It would be convenient to fold the runner trailing-stop failure into the deployed-source divergence. The evidence does not allow it.
**Evidence.** On 2026-09-01, `SDK_NQ_R_254a84ddcec7` — Long 1 NQ, resolved `Mode2RunnerOnly` — ran to an operator-observed ~+$1,200 unrealized (roughly 240 ticks MFE) and closed flat at `PNL_UPDATE DayPnL=($200.76)`. That figure is not approximate: 39 ticks × $5.00 + $5.76 commission = $200.76, matching a separate full-stop loss on 2026-08-27 to the penny.
**Mechanism.** GAP-054's fix — removing the auto-breakeven block that was clobbering `SetTrailStop` — lives in `NT8StrategyBase.cs`, which **is** current in deployment (it differs from the working tree by exactly the one uncommitted GAP-064 `FileLog` line). `SubmitOrderToNT8`'s runner arming is likewise adapter-side. So the fix was live on 2026-09-01 and the trade still behaved as though the trail never ratcheted.
**Consequence.** GAP-054 remains the system's only unexplained money-relevant defect, and it now blocks Gate Run #3 on its own, independently of everything in Findings 1–4. One live-money-relevant caveat compounds it: Finding 3 means the trail was 12 ticks, not the 20 the subclass intended, so any prior reasoning about its economics used the wrong number.
**Remedy.** `TASK_GAP054_FOLLOWUP_TRAIL_VALIDATION_FAILURE_PROMPT.md` was staged 2026-09-02 and has never been picked up. §9.5 **P2-A**. The cheapest available new diagnostic is `TraceOrders = true` (§5.17) — NT8's own order-lifecycle tracing is currently off, and turning it on would show directly which protective exit NT8 registered for the runner signal.
#### Finding 6 — The project has been stopped for two weeks, and the governance process could not see it
**Evidence.** HEAD is `186e1dd`, unchanged since 2026-08-26. `git status` is byte-identical to its 2026-09-08 state: the same four modified files, the same five untracked. `TASK_GAP064_FOLLOWUP2_ONBAR_TRACE_PROMPT.md`, staged 2026-09-08, has not been opened. The verified-good GAP-064 `FileLog` fix remains uncommitted. No session log exists after 2026-09-08 19:07 ET, so the live strategy has been stopped for a fortnight.
Meanwhile the weekly governance cadence fired on schedule on 2026-09-13 and 2026-09-20. Both runs had no repo access. Both correctly reported that they could not verify anything. The 2026-09-20 review flagged the situation itself as its material finding and asked the right question — whether work had paused or the sync path had broken. It had no way to answer it.
**Consequence.** The cadence rule from `DEC-20260816-01` is being followed faithfully and is producing nothing of value. Four consecutive reviews have restated the same unverified list. This is not a discipline failure; it is a design failure in the review, which was specified without a guaranteed path to the artifact it reviews.
**Remedy.** §9.3 **P0-E**: either give the scheduled session device access, or change the cadence to require the operator to run a three-command state capture and paste it in. Guardrail 20, §20. And separately, §9.3 **P0-D**: `git push`. Forty-four commits and the entire project's history exist on exactly one machine.
### 1.4 What the system has actually earned
Stated plainly, because the gap between built and validated is the project's central tension:
- **Earned.** A genuinely platform-neutral core with real test coverage. A risk architecture with four tiers, startup envelope assertions, and portfolio-level guards. A confluence scorer with ten factors and correctly-normalised designed weights. A provenance trail that records `ConfigHash` and `CodeVersion` per session and per trade — which is what made Finding 1's corroboration possible. Twenty-one gaps closed, diff-verified, since v7.0.
- **Not earned.** Any claim about profitability. Four broker-confirmed trades is not a sample. Gate Run #3 has never started. No walk-forward validation exists. No commission or slippage model informs the expectancy math, and `Slippage = 0` makes every backtest optimistic by one to two ticks per side.
- **Newly un-earned.** Every behavioural conclusion drawn from live logs between 2026-07-13 and today describes a program six weeks older than the one in the repository. That includes the `DEC-20260825-04` grade-distribution study, the GAP-047 weight rescore's `STATE:`-derived population, and both GAP-064 investigations. The *observations* remain valid as records of what the running system did; the *inferences* about repo source do not.
### 1.5 The bottom line for someone picking this project up today
Six sentences, if you read nothing else.
The architecture is good and the code is real, but for the last three months NinjaTrader has been compiling a July copy of the strategy that sits orphaned in its own Strategies folder, so the thing being debugged and the thing running were different programs. That single fact explains the "silent pipeline" defect completely, explains why a fix deployed in August never changed anything, and invalidates the inferences — though not the observations — of every log study since. A separate and genuine defect remains: the runner's trailing stop did not protect a trade that ran +$1,200 in the operator's favour on 2026-09-01, and that is still unexplained. Nothing has moved in the repository for two weeks, and the weekly review process could not see that because it has had no access to the repository for four. Before anything else happens, delete the orphan file, redeploy, recompile, verify the deployed tree against the repo, and push 44 commits that exist nowhere but one laptop. Then, and only then, is any log evidence this project collects worth reasoning about.
### 1.6 The four structural lessons
**Lesson 1 (carried forward, v7.0).** Completion claims must cite grep-verifiable evidence. Compiler output, test output and runtime artifacts override any board claim.
**Lesson 2 (carried forward, v7.0, and this revision is its proof).** A review process that sees one data channel will reach confident wrong conclusions. v7.0 wrote that sentence about dashboards and logs. It applies with more force to source code: four revisions of this document read the repository and described a program that was not running.
**Lesson 3 (carried forward, v7.0).** Documentation drift in a risk system is a risk control failure, not a documentation problem. Every parameter default, formula and control in this document carries a source citation and is re-verified at each revision.
**Lesson 4 (new, v9.0).** *The deployed artifact outranks the repository.* Source code is what you intend to run. It is evidence of intent, not evidence of behaviour. Any diagnostic reasoning that starts from source must first establish that source is what executed — and in a platform like NinjaScript, where the host compiles a folder you do not fully control, that is a real question with a cheap answer nobody was asking. This lesson is now rank 4-equivalent in the authority hierarchy (§2.4) and a standing pre-market check (§16.1).
---
## 2. ONBOARDING — PICKING THIS PROJECT UP COLD
This section exists so that a competent engineer or LLM with no prior context can be productive
within a day. If you are that person, read §1, §2, §6 and §9, in that order, then come back for the
rest.
One instruction overrides everything else in this section, and it is new in v9.0: **before you
reason about what this system does, verify what is deployed.** For three months this project
reasoned about behaviour from repository source while a different copy of the signal engine was
executing inside NinjaTrader — the deployed-source divergence (§6.3). Every conclusion drawn from
repo source in that window is suspect. Do not repeat the mistake on your first day.
### 2.1 Day-one orientation path
| Step | Read or run this | Why | Time |
|---|---|---|---|
| 1 | §1 and §6 of this document | What the system is, what is broken, what has actually earned money, and what the headline finding means for everything written before 2026-09-22 | 35 min |
| 2 | **Diff the deployed NinjaTrader Strategies folder against the repo.** `Get-ChildItem "$env:USERPROFILE\Documents\NinjaTrader 8\bin\Custom\Strategies" -Filter *.cs` and compare every file against its repo counterpart by SHA-256 and line count | **New in v9.0, and non-negotiable as step 2.** This is the step whose absence cost this project three months. Verified this session: `SimpleORBStrategy.cs` in that folder is dated 2026-07-13, 1,189 lines / 51,465 bytes, against a repo copy of 1,531 lines / 67,242 bytes | 20 min |
| 3 | `git -C C:\dev\nt8-sdk log --oneline -30` and `git status --porcelain` | What was last done and what is uncommitted. Verified this session: HEAD `186e1dd` (2026-08-26), 86 commits total, **44 unpushed to origin**, 4 modified files and 5 untracked — byte-identical to the 2026-09-08 state. **No work has happened in the repository for two weeks** | 10 min |
| 4 | `docs/00-governance/current_status.md` and `active_work.md` | The team's own account of the present blocker set. Read them knowing both are ~4 weeks stale (last substantive update 2026-08-25 and 2026-08-24) | 15 min |
| 5 | `docs/00-governance/decisions.md`, newest 25 entries | Why things are the way they are. Each entry carries Context / Decision / Consequences / Related Files / Action Required. This is the single best-maintained artifact in the project and it is the design rationale in chronological order | 40 min |
| 6 | `SPRINT_BOARD.md` | What is active, queued and completed, with dates and verification trailers. Treat the trailers as claims to check, not facts — `DEC-20260826-02` exists because a trailer contradicted the governance docs written in the same commit | 15 min |
| 7 | **Open the newest `session_*.log`** in `Documents\NinjaTrader 8\log\nt8-sdk` — today `session_20260908_082122.log` | What the running system was actually doing. Verified: 12,161 lines, **0 `SIGNAL:`**, **0 `OrbRangeNotEstablished`**, **0 `GradeFilter`**, 115 `STATE:`, 11,709 `HistoricalReplayCatchup`. The cleanest single piece of GAP-064 evidence in the archive. **No session log exists after it** — the live strategy has been stopped since 2026-09-08 19:07 ET | 30 min |
| 8 | Read the newest `settings_*.txt` beside it | The effective configuration, which is not the source defaults. Verified: `MaxTradeRisk $250`, `MinTradeGrade 4`, `MaxOpenPositions 3`, `BarsRequiredToTrade 1`, `Runner True \| Trail=12ticks`, `EnableKillSwitch False`, `ConfigHash 3c902e60…`, `CodeVersion 8.1.9.0:7a27cca8…`. Four of those contradict `SimpleORBNT8.SetDefaults()` — Finding 2 (§6.4) | 15 min |
| 9 | `verify-build.bat` (or `dotnet test NT8-SDK.sln --configuration Release --verbosity minimal`) | That the tree still builds and the suite still passes. Expect **562 `[TestMethod]`** statically; the governance docs' "580 passed" is `[DataRow]` expansion of the same suite, not a contradiction | 10 min |
| 10 | §5 of this document — the parameter reference | What every knob does and which ones fight each other. Read the "effective value" column, not the "source default" column | 45 min |
| 11 | §9 and §10 of this document | What to do next and in what order | 30 min |
**Do not start by reading source.** `NT8StrategyBase.cs` is 3,011 lines and `SimpleORBStrategy.cs`
is 1,531; between them they will consume a day without giving you the model. Read the decision log
first. And when you do read source, read the **deployed** copy alongside the repo copy, because
step 2 above exists precisely because those two are not the same file.
### 2.2 The mental model in five sentences
A NinjaScript strategy (`SimpleORBNT8`) inherits a shared orchestration base (`NT8StrategyBase`)
that owns everything except entry logic. Entry logic lives in a pure-C#, platform-free `IStrategy`
implementation (`SimpleORBStrategy`) that sees only bars and emits a `StrategyIntent`. The base
class takes that intent through a fixed sequence of guards — historical-replay block, RTH window,
kill switch, portfolio risk, per-strategy risk, sizing, circuit breaker — and only then submits
managed NT8 orders. Everything the base class does is written to a session file in a parseable line
format, and a separate read-only Python toolchain (`tools/`) parses those files for triage and
dashboarding without ever touching NinjaTrader. **Adding a second strategy means writing a new
`IStrategy` plus a thin NinjaScript subclass; it does not mean touching the shared base — but the
`IStrategy` half is compiled into a DLL that NinjaTrader will silently override with any same-named
`.cs` file sitting in its own `Strategies` folder, which is the whole of §6.3.**
### 2.3 Repository map
Counts verified this session by `find`/`wc`, excluding `bin/` and `obj/`.
| Path | Contains | Read it when |
|---|---|---|
| `src/NT8.Core/` | Platform-free SDK. 74 files, **22,209 lines**. Risk, Sizing, OMS, Intelligence, Analytics, MarketData, Execution, Indicators, Calendar, Logging. Zero `NinjaTrader.*` references | Changing decision logic |
| `src/NT8.Adapters/` | 15 files, **5,560 lines**. The only layer that knows NinjaTrader exists. `Strategies/NT8StrategyBase.cs` (3,011 lines) is the orchestrator; `Strategies/SimpleORBNT8.cs` (677 lines) is the NinjaScript entry point; `Wrappers/` holds the two legacy wrapper sources `deploy-to-nt8.bat` still copies | Changing order flow, guards, telemetry |
| `src/NT8.Strategies/Examples/SimpleORBStrategy.cs` | **One file, 1,531 lines.** The ORB signal engine, pure C#. Compiled into `NT8.Strategies.dll`. **`deploy-to-nt8.bat` never copies this file, and a 2026-07-13 orphan copy of it is what has actually been executing** | Changing entry conditions |
| `src/NT8.Contracts/` | **Zero `.cs` files.** Still in `NT8-SDK.sln`; builds as an empty assembly | Never. Delete it or fill it |
| `src/_archive/` | 6 retired files kept for reference | Forensics only |
| `tests/` | `NT8.Core.Tests` (472), `NT8.Integration.Tests` (80), `NT8.Performance.Tests` (10) = **562 `[TestMethod]`**, plus a `_archive/` with 5 more that are not in the solution | Always, before and after a change |
| `tests/NT8.Core.Tests/Adapters/` | 11 files. Two are real execution tests (`NT8DataConverterTests` 22, `NT8ExecutionAdapterTests` 14). **The other nine are source-text assertions — 29 tests that read a `.cs` file and grep it.** §15.3 | Before adding coverage for either NinjaScript-derived file |
| `docs/00-governance/` | **The authoritative project state.** 11 files: `decisions.md`, `current_status.md`, `active_work.md`, `roadmap.md`, `architecture.md`, `common_failures.md`, `patterns_and_antipatterns.md`, `compile_guardrails.md`, `executive_summary.md`, `CLEANUP_LOG.md`, `2026-08-19-run-book.md` | Every session, first |
| `docs/01-specs/` | **Empty.** As are `docs/api/` and `docs/deployment/` | — |
| `docs/02-runbooks/` | 10 files including `weekly_roadmap_cadence.md`, `session_start_workflow.md`, `live_test_review_workflow.md`, `compile_error_triage_workflow.md` and the operator runbook `.docx` | Before running a gate session |
| `docs/gate-runs/gate3/` | Freeze captures, `baseline.json`, `DEC-GATE3-CONFIG.md`. The only subdirectory under `docs/gate-runs/` | Before starting or auditing a gate run |
| `docs/architecture/` | 26 design specs, largely aspirational Phase-1 material | When designing new subsystems |
| `docs/archive/` | 11 items of historical phase specs and fix specs | Forensics only |
| `Specs/SDK/` | 6 original build-package specs (`core_interfaces_package.md`, `risk_management_package.md`, `position_sizing_package.md`, `repository_setup_package.md`, `complete_validation_script.txt`, `Handoff Summary.md`). This is the project's *origin* documentation — useful for understanding intent, useless for current state | Archaeology |
| `tools/` | **Nine directories.** Seven have content: `configdiff`, `dashboard`, `logtriage`, `logwatch`, `preflight`, `rescore`, `runnersweep`. **Two contain only `.gitkeep`** — `market-data` and `replay` are placeholders, not tools. §2.5 | Daily operation |
| `.kilo/worktrees/` | Four git worktrees left behind by Kilocode task runs: `gap-050-advanced-risk-qty`, `gap-053-stale-docs-prune`, `gap-056-inert-breakeven-params`, `gap-057-stop-trail-test-seam`. **They are working state, not authority.** A worktree's HEAD can be ahead of, behind, or divergent from `cleanup/wrappers-pass2`; never read one as "the code" | Only when auditing what a specific Kilocode task did |
| `.kilo/`, `.kilocode/`, `.aiconfig`, `.hermes` | Agent configuration and plans | When changing how Kilocode is driven |
| `deployment/` | `deploy-to-nt8.bat`, `Deploy-To-NT8.ps1`, `Verify-Deployment.ps1`, `NT8/install-instructions.md`, `backups/` (**103 folders**, newest `20260826_011650`), and `dev/`, `prod/`, `staging/` — **all three empty** | Every source change that must reach NT8 |
| `.gitea/workflows/` | CI: `build.yml`, `ci.yml` | When CI breaks |
| `rules/`, `plans/`, `scripts/` | Compile-error guidance and NinjaScript compile spec; one analysis report; one `ci_build.sh` | `rules/nt8compilespec.md` before writing any NinjaScript |
| Repo root `TASK_*.md` | 35 staged Kilocode prompts, one per work item | When handing work to Kilocode |
**Root-level clutter warning.** The repository root holds 60 markdown files — 35 `TASK_*.md` prompts
and 25 others, several long stale (`NEXT_STEPS_RECOMMENDED.md` and `POST_INTEGRATION_ROADMAP.md`
from 2026-02, `archon_*.md` from 2025). They are not authoritative. `docs/00-governance/` is.
### 2.4 Where truth lives — artifact authority hierarchy
When two sources disagree, the higher row wins. This ordering is not optional.
| Rank | Artifact | Why it ranks here |
|---|---|---|
| 1 | Broker execution grid / statement | The only record of what actually happened with money |
| 2 | NinjaTrader `session_*.log` | Written by the running strategy, unconditionally, at the moment of decision |
| 3 | `settings_*.txt` and `provenance_*.json` exports | Machine-generated configuration and code-version stamps at session start. **These carry effective values, which is why they caught Finding 2** |
| 4 | Compiler output and `dotnet test` results | What the code does, not what it claims |
| **4=** | **The deployed artifact — the actual `.cs` files in `bin\Custom\Strategies` and the `NinjaTrader.Custom.dll` built from them** | **New in v9.0, and the lesson of this revision. What NinjaTrader compiled outranks what the repository holds, because they are not the same thing** |
| 5 | Source code in `C:\dev\nt8-sdk\src` | Intent, and not necessarily what is deployed |
| 6 | `docs/00-governance/*.md` | Curated project state; accurate but can lag by weeks |
| 7 | `SPRINT_BOARD.md` and `TASK_*.md` | Working documents; can be aspirational |
| 8 | This master document | Synthesised; superseded by anything above it |
| 9 | Any LLM's recollection of a prior session | **Zero authority. Re-read the artifact.** |
`trades_*.jsonl` is deliberately not in this list at a high rank. Per `DEC-20260817-01` it silently
failed to write for a period covering broker-confirmed trades, and per `DEC-20260817-02` the
2026-08-17 file contains 57 phantom rows from a 14-second historical replay burst. Treat it as rank
5 at best.
**Why inverting this is expensive — this project's own bill.**
| Incident | Inversion committed | Cost |
|---|---|---|
| **The deployed-source divergence (§6.3)** | Rank 5 (repo source) was treated as rank 4 (deployed artifact). Nobody looked in `bin\Custom\Strategies` | Three months of GAP-034 and GAP-064 diagnosis chasing a signal-generation defect that was a *file-identity* defect. GAP-062's entire fix was never live. Three weeks of "GAP-062 SIM validation overdue" were never validatable |
| **Finding 2 (§6.4)** | Rank 5 (`SetDefaults()` source) was treated as rank 3 (settings export). Every parameter table in v6.1 through v8.0 quoted source defaults | The strategy has been trading a 12-tick runner trail while its own subclass asked for 20, and `deploy-to-nt8.bat` has been telling the operator to "Verify defaults: … RunnerTrailTicks=20" — an assertion that is **unsatisfiable from source** |
| **v6.3's invented gap register** | Rank 3 exports were read without rank 5/6 access, and the conclusions were written as fact | Six fabricated gap numbers (GAP-031–036) colliding head-on with a real, independently maintained register. v6.4 spent its revision renumbering |
| **`DEC-20260826-02`** | Rank 7 (`SPRINT_BOARD.md`) and rank 6 (`decisions.md`) were trusted over rank 4 (the commit's own build trailer and `deployment/backups/`) | A behaviour-changing scoring fix (GAP-062) reached the live install while two governance documents recorded "deploy intentionally skipped" |
| **`DEC-20260825-04`** | Rank 5 was trusted over rank 2 | The GAP-060 fix was correct in source, committed, and never running — the live strategy was executing the pre-fix binary because deployment had been blocked by an `NinjaTrader.exe` file lock and never completed. A week of `REJECT SUMMARY` analysis was analysing the wrong build |
Five incidents, one pattern: **something below rank 4 was believed about something at or above rank
4.** The hierarchy is the cheapest control in this project and the one most consistently skipped.
### 2.5 Environment and toolchain
| Component | Version / constraint | Note |
|---|---|---|
| Language | **C# 5.0 syntax only** | NinjaScript compiler constraint. No `?.`, no string interpolation, no expression-bodied members, no `nameof`. `rules/nt8compilespec.md` and `docs/00-governance/compile_guardrails.md` carry the full rule set. This is the most common cause of compile failures |
| Framework | **`net48`, all seven projects** | Verified: every `.csproj` and `Directory.Build.props` in `src/` and `tests/` sets `net48`. There is no multi-targeting |
| Test framework | **MSTest**, not xUnit | `[TestMethod]` / `[TestClass]` / `[DataRow]`. Anyone writing `[Fact]` is writing a test that will not run |
| Test count | **562 `[TestMethod]`** — 472 Core / 80 Integration / 10 Performance | Static grep count, verified this session. Governance docs quote "580 passed"; the difference is `[DataRow]` expansion at execution time, not a discrepancy. State it that way |
| Build and test | `verify-build.bat` | `dotnet clean` → `dotnet restore` → `dotnet build --no-restore --configuration Release` → `dotnet test --no-build --configuration Release`, with an `ERRORLEVEL` gate after each. Emits Unicode check/cross glyphs, which is why it has historically misbehaved under some `cmd.exe` code pages |
| Faster loop | `dotnet test NT8-SDK.sln --configuration Release --verbosity minimal`, or `quick-build-test.bat` | — |
| Platform | NinjaTrader 8.1.9.0 | Code-version stamp `8.1.9.0:` appears in provenance and settings exports |
| Orders | **NT8 managed order API only** | `EnterLongManaged` / `EnterShortManaged`, with `SetStopLoss` / `SetProfitTarget` / `SetTrailStop` called *before* entry |
| Deploy | `deployment/deploy-to-nt8.bat` | See §2.6. **A `dotnet build` that succeeds proves nothing about what NT8 is running** |
| Docs pipeline | pandoc for `.md` → `.docx`; LibreOffice for the `.docx` → PDF leg | `docs/` carries v6.1, v6.4 and v7.0 master documents as `.docx` and the v7.0 visual pack as self-contained HTML. Nothing in the build depends on either tool |
| Agent tooling | Kilocode (VS Code) executes staged `TASK_*.md` prompts | §2.7 |
**The nine `tools/` utilities.** All are standalone Python or PowerShell with zero NinjaTrader
assembly references. None can affect trading. All are safe to run while the strategy is armed.
| Tool | ID | What it does | State |
|---|---|---|---|
| `configdiff` | TOOL-002 | Parses `settings_Simple_ORB_NT8_*.txt` exports and reports configuration drift across them | Built, documented. **Not in any daily routine** — it would have surfaced the nine-hash day of 2026-08-18 immediately |
| `logtriage` | TOOL-001 | Triages session logs, settings, provenance and trade JSONL into JSON. Owns the canonical `parse_key_values()` / `REJECT:` parser since `DEC-20260817-05` | Built, documented. Never run against the full archive by the operator — an open action item |
| `logwatch` | — | Read-only tailer for live session logs, with its own `test_logwatch.py` | Built, documented |
| `dashboard` | DASH-001/-003/-004 | Read-only HTTP server on `127.0.0.1` serving `index.html` and `console.html` from parsed log artifacts, with Apprise notifications | Built, running |
| `preflight` | TOOL-003 | Morning go/no-go checks plus the Gate 3 `--freeze` capture. **Check 5 compares the deployed `NT8StrategyBase.cs` against the repo copy by SHA-256** (`preflight.ps1` ~510–518), and `Write-DeployedSourceHashes` (~202–222) records a SHA-256 for **every** `.cs` in the Strategies directory into the freeze capture | Built. §15.4 explains why check 5 passed while §6.3 was live |
| `runnersweep` | RUNNER-001 | Offline analysis of NT8 Strategy Analyzer exports for the runner parameter sweep | Built, leg-matcher fixed. `RUNNER-001_sweep_output.json` still shows every combination `INVALID` for missing analyzer metadata |
| `rescore` | — | `rescore_weights.py`, the GAP-047 offline confluence-weight re-scoring study. Output committed as `GAP-047_weight_rescore_output.{json,md}` | Built and **run** — the only sweep-class tool with real output. **No README** |
| `market-data` | — | **Empty. Contains only `.gitkeep`** | Placeholder |
| `replay` | — | **Empty. Contains only `.gitkeep`** | Placeholder |
v7.0 described five tools and v8.0 described nine. Nine directories exist; **seven tools exist.**
Correcting that here so nobody spends an afternoon looking for `tools/replay`.
### 2.6 The deployment rule, and why v9.0 rewrites it
**The old rule, carried from v6.4 and v7.0, in two parts.**
*Dual deploy.* Every change to a strategy file must land in **both** `src/` and the NinjaTrader
`bin\Custom\Strategies` directory, and must then be manually compiled inside NinjaTrader. A
`dotnet build` that succeeds proves nothing about what NT8 is running.
*No deploy during a gate.* Once a gate run has started, do not deploy to the gate machine at all.
Branch-only work. A mid-gate recompile changes the `CodeVersion` stamp while leaving `ConfigHash`
identical — exactly why `DEC-20260714-01` added the code stamp — and it silently invalidates the
run. Gate Run #2 died partly of this class of problem.
**Both halves of that rule stand. Both were also insufficient, and v9.0 says why.**
The dual-deploy rule is a rule about an *action*. It says: run the script. It says nothing about the
*resulting state*. `deploy-to-nt8.bat` copies three DLLs, two wrapper sources, `NT8StrategyBase.cs`
and `SimpleORBNT8.cs`, and verifies each copy with an `if not exist` check — seven existence checks,
zero content checks, and no check at all on files the script does not copy. Verified this session:
- The script never copies, backs up, or verifies `SimpleORBStrategy.cs`, because that file lives in
a different project and ships inside `NT8.Strategies.dll`.
- A 2026-07-13 orphan copy of `SimpleORBStrategy.cs` sits in the Strategies folder declaring the
same fully-qualified type, and C# binds to the source copy over the referenced assembly.
- `manifest.txt` in each of the 103 backup folders records source and destination **paths only** —
no hashes, no git SHA, no file sizes. It cannot be used to prove what was deployed.
- `Verify-Deployment.ps1:15` expects `MinimalTestStrategy.cs` among the deployed strategy files.
`deploy-to-nt8.bat` has never copied it. **The two scripts disagree on the deployment contract**,
so whichever one you run, one of them is wrong.
Hence the new rule, and it is the operative sentence of this section:
> **A deploy is not complete when the script exits zero. A deploy is complete when the deployed tree
> has been verified against the repository — every `.cs` file in `bin\Custom\Strategies` accounted
> for by SHA-256 against a known repo path, and every file *not* accounted for explicitly identified
> and either removed or justified in writing.**
The second clause is the one that matters. A diff that only checks the files you expect to be there
cannot find a file you did not know was there. `preflight.ps1` check 5 already compares deployed
`NT8StrategyBase.cs` to the repo copy and has presumably been passing for weeks — correctly, since
that file *is* current — while the orphan sat two entries below it in the same directory listing.
The freeze capture even hashes the orphan. Nothing ever compared those hashes to anything.
§16.5 carries the corrected runbook, including the orphan-file sweep. §15.4 carries the test that
should enforce it in CI.
### 2.7 Division of labour
| Role | Owns | Does not do |
|---|---|---|
| **Operator (Mo)** | NinjaTrader configuration, arming and disarming, the manual NinjaScript compile, running gate sessions, exporting settings, deciding scope, approving decisions, and **every action that touches the deployed tree** | Write code |
| **Kilocode** | The VS Code coding agent. **All source changes.** Implements staged `TASK_*.md` prompts, runs the test suite, commits, and writes back to `SPRINT_BOARD.md` and `decisions.md`. Works in `.kilo/worktrees/` | Decide scope; change parameters on an armed strategy; deploy unless the prompt explicitly authorises it |
| **Claude (planning session)** | Authors `TASK_*.md` task prompts, reviews repository and runtime state, records decisions, reconciles governance docs, writes master documents, runs the weekly Sunday review, and **verifies Kilocode's implementations by reading the diffs** | **Never modifies `src/`.** Does not commit. Does not deploy |
Two constraints follow, and they are not soft.
**Claude has no code-execution access on the operator's machine.** Every parser change, every
PowerShell edit, every log-format assumption Claude reasons about is hand-traced against real
artifact text, never run. Several decision entries say so explicitly (`DEC-20260817-05`, `-09`,
`-10`, `DEC-20260818-04`). **Treat any Claude-authored claim about runtime behaviour as unverified
until the operator runs it.** Where this document asserts runtime behaviour, it cites a log line
that was read, not an inference that was made; where it could not, it says so.
**Verification is by diff, never by summary.** This is standing practice and it exists because
summaries have been wrong in both directions. `DEC-20260826-02` found a commit whose own trailer
read `Dual-deployed: yes, backup 20260826_005308` while `SPRINT_BOARD.md` and `DEC-20260826-01` —
written by the same agent in the same commit — both said "deploy intentionally skipped by task
prompt." `DEC-20260823-02` found a test that read as a real regression test and asserted a
tautology. In both cases the artifact contradicted the account of the artifact. Read the diff. Read
the deployed file. Read the log.
---
---
## 3. GLOSSARY
Alphabetical. Definitions are project-specific where this project's usage differs from general
usage, and say so where it does.
| Term | Meaning |
|---|---|
| **AVWAP** | Anchored Volume-Weighted Average Price, anchored at the session open. Used by the Trend confluence factor (price-vs-AVWAP and AVWAP slope) and by the short-side trend veto. `AVWAPCalculator`, `NT8.Core/MarketData` |
| **`BarsInProgress`** | NinjaScript's index of which data series delivered the current `OnBarUpdate` call. `BarsArray[0]` is the primary series; `BarsArray[1]` is the shared daily series the base class adds for regime and ORB context. Handling the wrong index is a classic NinjaScript defect class |
| **`CodeVersion` / MVID** | Assembly version plus `ManifestModule.ModuleVersionId`, stamped as `8.1.9.0:<32 hex>` in settings and provenance exports. Added by `DEC-20260714-01` to detect recompiles that change behaviour without changing `ConfigHash`. Its *constancy* across 2026-08-31, 09-03 and 09-08 is the corroborating evidence for §6.3 |
| **Confluence** | The ten-factor quality scoring system that gates entries ahead of risk validation. Each factor scores in [0,1]; the weighted composite maps to a Grade. `ConfluenceScorer`, `NT8.Core/Intelligence` |
| **`ConfigHash`** | SHA-256 over the NinjaScript parameter set, including `BarsPeriod` since GAP-038. Two sessions sharing a `ConfigHash` ran the same configuration; a gate sample must share one throughout |
| **DEC-YYYYMMDD-NN** | Decision-log entry ID in `docs/00-governance/decisions.md`. The project's design rationale, in chronological order |
| **Deployed-source divergence** | *New in v9.0.* The condition where a `.cs` file in NinjaTrader's `bin\Custom` compiles into `NinjaTrader.Custom.dll` and shadows the same fully-qualified type from a referenced SDK assembly, so the executing code is not the repository code. §6.3 |
| **ETH** | Extended Trading Hours — outside 09:30–16:00 ET. `EnableEthTelemetry` emits read-only `STATE:` telemetry in this window; no order path is reachable from it |
| **Freeze** | A `preflight.ps1 --freeze` snapshot: git SHA, clean-tree proof, test results, `ConfigHash`, `CodeVersion`, the last three settings exports, and SHA-256 of every `.cs` in the deployed Strategies folder |
| **GAP-nnn** | Gap-register entry. Numbering has a documented two-collision history; the repository's `roadmap.md` is authoritative for what a number means |
| **Gate run** | A fixed-configuration validation period: ≥2 calendar weeks **and** ≥20 broker-confirmed `RTH_ORB` trades on a single frozen account, instrument, bar type and `ConfigHash`. Three have been attempted; none has produced a valid sample; Gate Run #3 has never started |
| **Grade** | The confluence composite mapped to a letter: A+ ≥0.90, A ≥0.80, B ≥0.70, C ≥0.60, D below, F at floor. Enum values A+=6, A=5, B=4, C=3, D=2, F=1 |
| **HIST-nn** | Historical audit findings from the voided 2026-07-17→31 window, moved out of the `GAP-` namespace by v7.0 to make a third numbering collision structurally impossible |
| **Kilocode** | The VS Code coding agent that makes **all** source changes in this project, driven by staged `TASK_*.md` prompts. §2.7 |
| **Managed orders** | NinjaScript's higher-level order API (`EnterLongManaged`, `SetStopLoss`, `SetTrailStop`). The SDK uses it exclusively; unmanaged order handling is out of scope |
| **MFE / MAE** | Maximum Favourable / Adverse Excursion — the best and worst unrealised excursion during a trade. The ~240-tick MFE on the 2026-09-01 runner that closed at a full stop-out loss is the core GAP-054 evidence |
| **`MinTradeGrade`** | Integer grade gate. 5 = Grade A. Set on the strategy; read by `SimpleORBStrategy` from `_config.Parameters["MinTradeGrade"]`. **Effective live value is 4**, because the base `SetDefaults` overwrites the subclass's 5 — Finding 2 |
| **`Mode1DualLeg` / `Mode2RunnerOnly`** | Runner activation modes. `Mode1DualLeg`: scaler takes `Qty-1` at a fixed target, runner takes 1 on a trail. `Mode2RunnerOnly`: the whole position runs on the trail with no fixed target. `Auto` resolves to the first at Qty ≥ 2 and the second at Qty = 1. `Mode2RunnerOnly` has **never been observed submitting** in live or SIM |
| **NR4 / NR7** | Narrowest-Range-in-4 / in-7 sessions. The `NarrowRange` confluence factor scores NR7 at 1.0 and NR4 at 0.75, on the hypothesis that compressed ranges precede the largest post-ORB expansions |
| **NinjaScript** | NinjaTrader's C# scripting layer. Compiles every `.cs` under `Documents\NinjaTrader 8\bin\Custom` into a single `NinjaTrader.Custom.dll`. **That compilation model is the mechanism of §6.3** |
| **Optimal-f** | Fractional-Kelly position-sizing method implemented in `OptimalFCalculator` (`NT8.Core/Sizing`). Built, tested, and **not driving live sizing** — `BasicPositionSizer` is |
| **ORB** | Opening Range Breakout. The high/low of the first `OpeningRangeMinutes` (30) of RTH forms a range; a confirmed two-bar close beyond a volatility-buffered trigger enters |
| **`P0-x` / `P1-x` / `P2-x`** | Stage task IDs from the v7.0 roadmap: Stage 0 unblock, Stage 1 trustworthy instrument, Stage 2 runner resolution |
| **Property shadowing** | *New in v9.0.* A derived class re-declaring a base property name without the `new` keyword, producing two independent backing values under one name. Eight properties in `SimpleORBNT8` do this — Finding 3 (§6.5). Base-class code reading `this.EnableATRTrailing` reads the base copy, not the value the operator set in the derived property grid |
| **Provenance** | The chain of artifacts proving what configuration and code produced a given trade: `settings_*.txt`, `provenance_*.json`, `trades_*.jsonl`, and the session log |
| **R-multiple** | Trade result expressed in units of initial risk. A trade risking 8 ticks and making 16 is +2R. `RMultipleCalculator`, `NT8.Core/Execution` |
| **Regime gate** | Daily SMA20-vs-SMA50 trend classification, applied as `Disabled`, `GradePenalty` (downgrade one grade when the trend opposes) or `HardVeto`. Never arms below 50 daily bars — hence the 60-day backtest warm-up rule |
| **Replay burst** | NinjaTrader's historical catch-up at strategy enable, delivered as a rapid sequence of `OnBarUpdate` calls before the first live bar. The 2026-09-08 session compressed **11,709** of these into roughly one second, reaching back to bar `2026-03-06 10:20:00` — 36,303 historical minute bars against a configured `DaysToLoad=5`. Blocked from the order path by `DEC-20260818-08` and logged as `HistoricalReplayCatchup` |
| **RTH** | Regular Trading Hours, 09:30–16:00 ET. The live guard is `Time[0].TimeOfDay >= 09:30 && < 16:00` (`NT8StrategyBase.cs:762`). Sessions are tagged `RTH_ORB`, `ETH`, `HOLIDAY`, `EARLY_CLOSE` |
| **Runner** | The leg managed by a trailing stop with no fixed target. Signal name `SDK_{Symbol}_R_{hex}` |
| **Scaler** | The leg exiting at a fixed profit target. Signal name `SDK_{Symbol}_S_{hex}` |
| **`SetStopLoss` / `SetTrailStop`** | NinjaScript managed-order exit methods. **Signal-scoped and mutually exclusive per signal name** — the later call replaces the earlier exit order. GAP-054 is entirely a consequence of this, and `NT8StrategyBase.cs:807–815` now carries a source comment warning against both traps |
| **Source-text test** | A test that reads a `.cs` file from disk and asserts on its string contents rather than executing it. 29 of the 562 tests (5.2%) across nine files in `tests/NT8.Core.Tests/Adapters/`. Legitimate for the two NinjaScript-derived classes, which cannot be instantiated; a fraud risk otherwise. §15.3 |
| **`StartBehavior`** | NinjaScript strategy start-up synchronisation mode. Set to `AdoptAccountPosition` (both base and subclass) so NT8 does not submit or flatten during the replay burst before the first live bar. Documented and retained by `DEC-20260814-04` |
| **Tick value** | Dollar value of one tick per contract. Hardcoded as a `switch` in **both** `BasicRiskManager` and `BasicPositionSizer` — NQ $5.00, MNQ $0.50, ES $12.50, MES $1.25, default $12.50. Two copies of one table is a latent divergence (GAP-052) |
| **Trailing drawdown** | Funded-prop-style account floor tracking a high-water mark with an optional lock-in offset. `EnableTrailingDrawdown` is `False` live; enabling it without `AccountStartingBalance` is a hard entry block for the whole session |
---
---
## 4. ARCHITECTURE
Everything in this section was re-verified against live source and the deployed NinjaTrader
`bin\Custom` tree during this session (2026-09-22). Nothing has been carried forward from v7.0 or
v8.0 unverified. Where v7.0 was wrong, the correction is stated explicitly rather than quietly
applied.
### 4.1 The layered model
The SDK is three layers plus one empty placeholder, all seven solution projects targeting `net48`.
| Layer | Path | `.cs` files | Lines | Build output | May reference `NinjaTrader.*`? |
|---|---|---:|---:|---|---|
| Platform-neutral core | `src/NT8.Core/` | 74 | 22,209 | `NT8.Core.dll` | **No — invariant, §4.3** |
| NinjaTrader adapter | `src/NT8.Adapters/` | 15 | 5,560 | `NT8.Adapters.dll` (partial — see below) | Yes |
| Example strategy | `src/NT8.Strategies/` | 1 | 1,531 | `NT8.Strategies.dll` | No (it does not, and does not need to) |
| Contracts | `src/NT8.Contracts/` | **0** | **0** | `NT8.Contracts.dll` (empty assembly) | n/a |
| Archive (not a project) | `src/_archive/` | 6 | 2,000 | not built | n/a |
Counts taken with `find … -name '*.cs' -not -path '*/obj/*' -not -path '*/bin/*'` on
`$HOME/mnt/dev--nt8-sdk/src`, 2026-09-22.
`NT8.Core` breaks down by folder as follows. This is the first time the master document has
carried per-folder counts; they are the cheapest available proxy for where the complexity lives.
| `NT8.Core/` folder | Files | Lines | What it holds |
|---|---:|---:|---|
| `Analytics/` | 15 | 3,855 | Trade statistics, equity curve, reporting |
| `Intelligence/` | 10 | 3,711 | Confluence scoring, factor calculators, regime detection, grade filter, risk mode |
| `Execution/` | 11 | 3,571 | Circuit breaker, trailing-stop manager, slippage, R-multiple, contract roll |
| `OMS/` | 6 | 2,694 | Order models, state machine, type validator, basic order manager |
| `Sizing/` | 7 | 2,327 | Basic / advanced / grade-based / volatility-adjusted sizers, optimal-f |
| `MarketData/` | 6 | 2,024 | Bar and session models, AVWAP and derived series |
| `Risk/` | 5 | 1,910 | Basic and advanced risk managers, portfolio risk manager, envelope validator |
| `Common/` | 8 | 1,323 | Interfaces, configuration, `StrategyIntent`, `StrategyContext`, tick-value table |
| `Indicators/` | 2 | 495 | Platform-neutral indicator maths |
| `Logging/` | 3 | 188 | `ILogger`, `BasicLogger` |
| `Calendar/` | 1 | 111 | `CmeHolidayCalendar` |
`src/NT8.Contracts/` contains **zero `.cs` files** — only `NT8.Contracts.csproj`, `bin/` and
`obj/`. It is still listed in `NT8-SDK.sln` (project GUID `{0DB69C23-43C5-419D-A008-E7E9FDB13968}`)
and still builds, producing an empty assembly on every solution build. It is dead weight in the
build graph and a standing invitation to misread the architecture as having a contracts tier. It
does not; the contracts live in `NT8.Core/Common/Interfaces/` and `NT8.Core/Common/Models/`.
**The single most important structural fact about `NT8.Adapters` is in its `.csproj`:**
```xml
```
*(`src/NT8.Adapters/NT8.Adapters.csproj`)*
`NT8StrategyBase.cs` (3,011 lines) and `SimpleORBNT8.cs` (677 lines) — 3,688 of the adapter
project's 5,560 lines, 66% of it — are **excluded from compilation**. They are carried as content,
not code. `NT8.Adapters.dll` is 25,600 bytes on disk; it contains only the ten small files under
`NinjaTrader/`, `Wrappers/` and `ConfigHashCalculator.cs`. The two biggest and most behaviourally
significant files in the entire adapter layer are never compiled by MSBuild, never type-checked by
`dotnet build`, and never executed by any test. This is why 29 of the 562 tests are source-text
assertions (§4.4, and the test inventory in §7): they are the only mechanism available for
asserting anything at all about those two files.
### 4.2 Runtime flow and ownership
```
NinjaTrader 8 process
┌──────────────────────────────────────────────────────────────────────┐
│ Chart / Strategies tab │
│ │ OnStateChange, OnBarUpdate, OnOrderUpdate, OnExecutionUpdate │
│ ▼ │
│ SimpleORBNT8 : NT8StrategyBase : Strategy ← compiled by NT8 from │
│ │ source in bin\Custom │
│ │ BuildStrategyContext() / ConvertCurrentBar() │
│ ▼ │
│ ┌─────────────────────────────────────────┐ │
│ │ IStrategy _sdkStrategy │ ← SimpleORBStrategy │
│ │ .OnBar(BarData, StrategyContext) │ (see §4.4: WHICH │
│ │ returns StrategyIntent or null │ copy is a defect) │
│ └─────────────────────────────────────────┘ │
│ │ intent │
│ ▼ │
│ ProcessStrategyIntent(intent, context) ← NT8StrategyBase │
│ │ │
│ ├─► ApplyDynamicStopToIntent() → rewrites intent.StopTicks │
│ ├─► PortfolioRiskManager.ValidatePortfolioRisk() [NT8.Core] │
│ ├─► direction filter (EnableLong/ShortTrades) │
│ ├─► BasicPositionSizer.CalculateSize() [NT8.Core] │
│ ├─► BasicRiskManager.ValidateOrder(…, contracts) [NT8.Core] │
│ ▼ │
│ SubmitOrderToNT8(request, intent) │
│ ├─► ExecutionCircuitBreaker.ShouldAllowOrder() [NT8.Core] │
│ ├─► ResolveRunnerMode(RunnerActivationMode, qty) │
│ ├─► SetStopLoss / SetProfitTarget / SetTrailStop [NinjaScript]│
│ └─► EnterLong / EnterShort [NinjaScript]│
│ │
│ NT8 fill/order callbacks ─► OnOrderUpdate / OnExecutionUpdate │
│ └─► FileLog("ORDER …" / "FILL …" / "PNL_UPDATE …") │
└──────────────────────────────────────────────────────────────────────┘
│ │
▼ ▼
session_*.log settings_*.txt trades_*.jsonl provenance_*.json
(FileLog, on disk) (WriteTradeProvenance)
```
Ownership — who decides what, and in which assembly that decision lives:
| Concern | Owner | Assembly | Notes |
|---|---|---|---|
| Signal generation (is there a setup?) | `SimpleORBStrategy.OnBar()` | **`NinjaTrader.Custom.dll` in the deployed build** (intended: `NT8.Strategies.dll`) | The whole of §4.4 |
| Confluence scoring and grade | `ConfluenceScorer` + 10 `IFactorCalculator`s | `NT8.Core.dll` | Invoked from `SimpleORBStrategy`, and independently from `NT8StrategyBase` for telemetry |
| Grade filter (`MinTradeGrade`) | `SimpleORBStrategy` (inline compare), `GradeFilter` for the size multiplier | `NT8.Core.dll` types, decision in strategy | `(int)score.Grade < (int)minGrade → return null` |
| Stop distance | `NT8StrategyBase.ResolveDynamicStopTicks()` | deployed source | **Overrides the strategy's own `StopTicks`** when `EnableDynamicStop` |
| Position sizing | `BasicPositionSizer` | `NT8.Core.dll` | `FixedDollarRisk` method only |
| Per-trade / daily risk | `BasicRiskManager` | `NT8.Core.dll` | Tier 1 only; see §4.6 |
| Portfolio risk | `PortfolioRiskManager.Instance` | `NT8.Core.dll` | Singleton, hard-coded limits |
| Trailing drawdown | `TrailingDrawdownMonitor` (private nested class) | deployed source, `NT8StrategyBase.cs:2622` | Not in `NT8.Core` |
| Order submission and protective exits | `NT8StrategyBase.SubmitOrderToNT8()` | deployed source | Managed-order `Set*()` + `EnterLong/Short` |
| Circuit breaking | `ExecutionCircuitBreaker` | `NT8.Core.dll` | 3 failures / 30 s |
| Logging to disk | `NT8StrategyBase.FileLog()` | deployed source | §4.12 — the reach of this method is the single biggest observability variable in the system |
Two ownership facts are worth stating flatly because they have repeatedly been assumed otherwise:
1. **`NT8.Core` owns no order.** It never touches NinjaScript. Every `EnterLong`, `SetStopLoss`
and `SetTrailStop` call in the system is in `NT8StrategyBase.cs`, a file that MSBuild does not
compile.
2. **The risk manager does not see the stop the strategy asked for.** `ApplyDynamicStopToIntent()`
runs first and rewrites `intent.StopTicks` in place; everything downstream — sizing, risk
validation, the `SUBMIT` log line, `SetStopLoss` — sees the ATR-derived value. §4.9.
### 4.3 The platform-neutral invariant
**The rule.** `src/NT8.Core/**` must contain no reference to any `NinjaTrader.*` type, namespace or
assembly. The core is compiled and tested without NinjaTrader present; it must remain so.
**Verified, 2026-09-22.** Grepping the string `NinjaTrader` across all 74 `.cs` files of
`src/NT8.Core` (excluding `obj/` and `bin/`) returns **7 hits in 1 file**, and every one is inside
an XML doc comment:
```
NT8.Core/OMS/INT8OrderAdapter.cs:7: /// NinjaTrader 8 order adapter interface - provides abstraction layer between OMS and NT8
NT8.Core/OMS/INT8OrderAdapter.cs:12: /// Submit order to NinjaTrader 8
NT8.Core/OMS/INT8OrderAdapter.cs:19: /// Modify existing order in NinjaTrader 8
NT8.Core/OMS/INT8OrderAdapter.cs:26: /// Cancel order in NinjaTrader 8
NT8.Core/OMS/INT8OrderAdapter.cs:33: /// Register callback for order status updates from NinjaTrader 8
NT8.Core/OMS/INT8OrderAdapter.cs:45: /// Connect to NinjaTrader 8
NT8.Core/OMS/INT8OrderAdapter.cs:51: /// Disconnect from NinjaTrader 8
```
There are **zero** `using NinjaTrader.*` directives, zero `NinjaTrader.*` type references, and the
project file declares only two package references — `Microsoft.Extensions.Logging` 2.2.0 and
`Newtonsoft.Json` 13.0.3 — and no assembly reference to `NinjaTrader.Core.dll` or
`NinjaTrader.Custom.dll` (`src/NT8.Core/NT8.Core.csproj`). **The invariant holds.**
**Why it is worth the discipline.** `NT8.Core` is the only part of this system that 533 of the 562
tests can execute. The invariant is what makes those tests possible. Break it once and the entire
executable test surface collapses to the same untestable state as `NT8StrategyBase.cs`.
**What it cost to learn.** `NT8.Core/OMS/INT8OrderAdapter.cs` is the shape of the discipline: the
core declares the *interface* it needs from the platform, and `src/NT8.Adapters/NinjaTrader/`
implements it. Note, though, that `INT8OrderAdapter` is currently aspirational — the live path
does not route through it; `NT8StrategyBase.SubmitOrderToNT8()` calls NinjaScript's managed-order
methods directly and separately calls `_executionAdapter.SubmitOrder()` for bookkeeping. The
abstraction exists and is unused on the hot path. `PL-` items should record that rather than let it
read as an implemented seam.
**The invariant does not protect what matters most.** It keeps `NT8.Core` clean. It says nothing
about the 3,688 lines of `NT8StrategyBase.cs` + `SimpleORBNT8.cs`, which are excluded from
compilation entirely (§4.1) and are where every live defect in this document's history has lived.
Holding the invariant is necessary and has never been sufficient.
### 4.4 The compilation and deployment model — NEW IN v9.0, AND THE MOST IMPORTANT SUBSECTION IN THIS DOCUMENT
This subsection exists because for at least three months this project reasoned about behaviour from
repository source while a different copy of that source was executing. Everything below is verified
against the device this session; the finding itself is owned by §1 and §6.3 and is referred to here
as **the deployed-source divergence**.
#### 4.4.1 The four routes code can take into a running strategy
There are exactly four, and the project uses three of them simultaneously.
| # | Route | Artifact | Who compiles it | Verified on device |
|---|---|---|---|---|
| 1 | MSBuild → DLL → copied to `bin\Custom\` | `NT8.Core.dll`, `NT8.Adapters.dll`, `NT8.Strategies.dll` | `dotnet build` on the dev box | All three present, all dated **2026-08-26 05:16** |
| 2 | Source file copied into `bin\Custom\Strategies\` | `NT8StrategyBase.cs`, `SimpleORBNT8.cs`, `BaseNT8StrategyWrapper.cs`, `SimpleORBNT8Wrapper.cs` | **NinjaTrader**, into `NinjaTrader.Custom.dll` | All four present |
| 3 | Source file that is in `bin\Custom` but nothing deploys | `SimpleORBStrategy.cs` (orphan), `MinimalTestStrategy.cs`, `@@SimpleORBNT8Wrapper.cs`, ~340 others | **NinjaTrader**, into `NinjaTrader.Custom.dll` | 347 `.cs` files under `bin\Custom` |
| 4 | Third-party DLL dropped in `bin\Custom` | `Platinum_Algos_02.22.2026.dll`, `LuxAlgo*.dll`, `THE_VWAP_INTRADAY_DLL.dll`, `NT8.SDK.dll` (2025 legacy) | nobody — already compiled | Present |
Route 1 and route 2 are the designed pipeline. **Route 3 is the hole**, and route 4 is the reason
the folder is never clean enough for the hole to be obvious.
#### 4.4.2 What `deploy-to-nt8.bat` actually does
Read in full at `deployment/deploy-to-nt8.bat` this session. In order:
1. Asserts `%USERPROFILE%\Documents\NinjaTrader 8\bin\Custom` exists.
2. Asserts `NT8.Core.dll`, `NT8.Adapters.dll`, `NT8.Strategies.dll` exist under
`src\*\bin\Release\net48`.
3. Creates `deployment\backups\\` and copies the **three DLLs** and **two wrapper
`.cs` files** out of the live install into it. It does **not** back up `NT8StrategyBase.cs`,
`SimpleORBNT8.cs`, or `SimpleORBStrategy.cs`.
4. Writes `manifest.txt` — six lines: a timestamp, three source paths, two destination paths.
**No hashes, no git SHA, no file sizes, no list of what was actually copied.**
5. Copies the three DLLs into `bin\Custom\`.
6. Copies **four** `.cs` files into `bin\Custom\Strategies\`: `BaseNT8StrategyWrapper.cs`,
`SimpleORBNT8Wrapper.cs`, `NT8StrategyBase.cs`, `SimpleORBNT8.cs`.
*(Correction to the v9.0 briefing and to every earlier description: it is four source files, not
two. The two wrappers are copied from `src\NT8.Adapters\Wrappers\`; the two strategy files from
`src\NT8.Adapters\Strategies\`.)*
7. Verifies existence of the three DLLs and the **two wrapper** `.cs` files. It does **not** verify
`NT8StrategyBase.cs` or `SimpleORBNT8.cs` after copying them.
8. Deletes `NinjaTrader.Custom.dll` and `.pdb` to force a full NinjaScript recompile.
9. Prints next steps, including: *"Verify defaults: BreakevenTriggerTicks=20 RunnerTrailTicks=20
MaxContracts=3"*.
`SimpleORBStrategy.cs` is not mentioned anywhere in the script. It cannot be: it lives in
`src\NT8.Strategies\Examples\` and is compiled into `NT8.Strategies.dll`, which step 5 copies. In
the designed model it never needs to exist as a source file on the NinjaTrader side.
`deployment/Verify-Deployment.ps1` disagrees with the script it is supposed to verify:
```powershell
$requiredDlls = @("NT8.Core.dll")
$optionalDlls = @("NT8.Adapters.dll")
$strategyFiles = @("NT8StrategyBase.cs", "SimpleORBNT8.cs", "MinimalTestStrategy.cs")
```
It treats `NT8.Strategies.dll` as neither required nor optional — it does not check for it at all,
despite that being the assembly carrying the strategy implementation — and it requires
`MinimalTestStrategy.cs`, which `deploy-to-nt8.bat` never copies. (`MinimalTestStrategy.cs` *is*
present in the live folder, dated 2026-02-17, from some earlier manual copy, so the check happens
to pass. It passes for the wrong reason.) **The two halves of the deployment contract have never
agreed, and neither of them checks the thing that broke.**
Deployment state on the device, 2026-09-22: newest backup `deployment/backups/20260826_011650`;
**103 backup folders** in total; `deployment/{dev,prod,staging}/` all **empty**.
#### 4.4.3 NinjaTrader's compilation model, and the type-resolution rule
NinjaTrader 8 compiles **every `.cs` file anywhere under `bin\Custom`** into a single assembly,
`NinjaTrader.Custom.dll`, referencing every DLL in that folder. On this device that is **347 `.cs`
files**. The resulting assembly is 1,509,888 bytes, dated **2026-08-26 10:29** — five hours after
the DLLs were copied at 05:16, consistent with the operator restarting NinjaTrader that morning and
NinjaTrader recompiling after the script deleted the old assembly.
The rule that turns this into a defect is a plain C# name-resolution rule:
> When a type name resolves both to a type declared in the **current compilation** and to a type in
> a **referenced assembly**, the compiler binds to the one in the current compilation.
`SimpleORBNT8.cs:23` declares `using SdkSimpleORB = NT8.Strategies.Examples.SimpleORBStrategy;` and
`SimpleORBNT8.cs:202` does `return new SdkSimpleORB(OpeningRangeMinutes, StdDevMultiplier);`. The
name `NT8.Strategies.Examples.SimpleORBStrategy` exists in two places at NinjaScript compile time:
in the referenced `NT8.Strategies.dll`, and in the orphan source file
`bin\Custom\Strategies\SimpleORBStrategy.cs`. The source copy wins. Silently. With no warning that
would be visible in the NinjaTrader Output window's ordinary noise.
Verified file facts, device, 2026-09-22:
| File | Deployed copy | Repository copy | Identical? |
|---|---|---|---|
| `bin\Custom\Strategies\SimpleORBStrategy.cs` | 51,465 B, **1,189 lines**, **2026-07-13 20:36** | 67,242 B, **1,531 lines**, 2026-08-26 04:49 | **No — 342 lines behind** |
| `bin\Custom\Strategies\NT8StrategyBase.cs` | 133,611 B, 2026-08-26 05:15 | 133,718 B, 2026-09-08 03:43 | **No — exactly one line behind** |
| `bin\Custom\Strategies\SimpleORBNT8.cs` | 31,213 B, 2026-08-25 20:21 | 31,213 B | **Yes** (md5 match) |
The `NT8StrategyBase.cs` difference is worth stating precisely, because it is small and consequential:
```
$ diff Custom/Strategies/NT8StrategyBase.cs src/NT8.Adapters/Strategies/NT8StrategyBase.cs
854a855
> FileLog(string.Format("SDK ONBARUPDATE FAILED: {0}: {1}", ex.GetType().Name, ex.Message));
```
That is the entire difference — the uncommitted, verified-good GAP-064 `FileLog` fix. **It is not
deployed.** `SDK ONBARUPDATE FAILED` cannot appear in any session log produced by the current
build, and any reasoning that treats its absence as evidence that `OnBarUpdate()` did not throw is
invalid. See §4.12, where it is marked written-but-not-deployed.
#### 4.4.4 The two paths, drawn
**Intended:**
```
src/NT8.Strategies/Examples/SimpleORBStrategy.cs
│ dotnet build -c Release
▼
NT8.Strategies.dll ──────────────────────────────┐
│ copy
src/NT8.Core/** ──► NT8.Core.dll ───────────────┤
src/NT8.Adapters/NinjaTrader/** ──► NT8.Adapters.dll
│
src/NT8.Adapters/Strategies/NT8StrategyBase.cs ──┤ copy as SOURCE
src/NT8.Adapters/Strategies/SimpleORBNT8.cs ───┤
src/NT8.Adapters/Wrappers/*.cs ───┘
│
▼
bin\Custom\ { 3 DLLs } + bin\Custom\Strategies\ { 4 .cs }
│
NinjaTrader compiles the .cs files,
REFERENCES the DLLs
▼
NinjaTrader.Custom.dll
│
new SdkSimpleORB(...) ──► NT8.Strategies.dll's
SimpleORBStrategy ✔
```
**Actual:**
```
src/NT8.Strategies/Examples/SimpleORBStrategy.cs (1,531 lines, 2026-08-26)
│ dotnet build -c Release
▼
NT8.Strategies.dll ─────────── copied 2026-08-26 05:16 ──────┐
│
███ bin\Custom\Strategies\SimpleORBStrategy.cs ███ │
███ 1,189 lines, 2026-07-13, ORPHAN ███ │
███ declares NT8.Strategies.Examples.SimpleORBStrategy ███ │
███ nothing copies it, backs it up, or checks it ███ │
│ │
└──────────────► same fully-qualified type ◄───────────┘
│
NinjaTrader compiles bin\Custom\**\*.cs (347 files)
and references the DLLs
│
C#: source in current compilation BEATS referenced assembly
▼
NinjaTrader.Custom.dll (2026-08-26 10:29)
│
new SdkSimpleORB(...) ──► the 2026-07-13 ORPHAN ✘
│
▼
no RecordSignalRejection · no signal_reject_reason · no OrbRangeNotEstablished
no RegimeVeto · no trend_confirm_long / trend_confirm_short
```
Grep counts against the deployed orphan, this session: `RecordSignalRejection` **0** (repo: 11),
`signal_reject_reason` **0**, `OrbRangeNotEstablished` **0**, `RegimeVeto` **0**,
`trend_confirm_long` **0**. `return null;` appears 10 times in the orphan against 11 in the repo
copy. The two occurrences of the string `GradeFilter` in the orphan are the `GradeFilter` *type*
(field declaration, line 26; construction, line 300), not a log or reject label — the orphan has no
way to name a grade rejection anywhere an operator can see it.
Both copies register the same ten factor calculators in the same order (orphan lines 306–315; repo
lines 317–326), so the confluence model itself is not stale. The divergence is concentrated
entirely in the **reject-reporting** and **direction-confirmation** paths — which is precisely why
it presented as silence rather than as wrong trades.
#### 4.4.5 Why nothing caught it
Six independent guards that could have caught this, and why each did not:
| Guard | Why it did not fire |
|---|---|
| `deploy-to-nt8.bat` step 7 verification | Checks existence of 5 files it just wrote. An orphan it never writes is invisible to an existence check. |
| `deployment/backups/*/manifest.txt` | Records source and destination *paths*. No hashes, no sizes, no SHA. Two manifests from different code states are byte-identical apart from the timestamp. |
| `Verify-Deployment.ps1` | Different, smaller file list; does not check `NT8.Strategies.dll` at all; passes on a file the deploy script never copies. |
| `ConfigHash` in `settings_*.txt` | Hashes `[NinjaScriptProperty]` values plus eight settings-export fields (`NT8StrategyBase.cs ~2770–2800`). It is a hash of **configuration**, not of code. Identical across 2026-08-31, 2026-09-03 and 2026-09-08 because the configuration genuinely did not change. |
| `CodeVersion` in `settings_*.txt` | `GetType().Assembly` version + `ManifestModule.ModuleVersionId` (`NT8StrategyBase.cs ~2396–2410`). For `SimpleORBNT8` that assembly is **`NinjaTrader.Custom.dll`** — so `CodeVersion 8.1.9.0:7a27cca81894406c863494a6cb81f749` is a genuine fingerprint of the compiled NinjaScript assembly. It was constant across the whole window because that assembly genuinely was not rebuilt after 2026-08-26 10:29. **This field did its job.** Nobody was reading it as a change-detector. |
| The 562-test suite | `SimpleORBStrategy.cs` in the repo is exercised by tests. The orphan is not in the repo and cannot be. No test in this project has ever read a file out of `bin\Custom`. |
**What a correct deployment model looks like.** Stated as a specification, not as a patch —
no code was changed in producing this document.
1. **One route per artifact.** A type is either compiled into a DLL or shipped as NinjaScript
source. Never both. The deploy must fail if any `.cs` under `bin\Custom` declares a type that
also exists in a deployed DLL. A single `ildasm`/`Mono.Cecil` type-name intersection check is
sufficient and takes seconds.
2. **Deploy by clearing, not by overwriting.** The deploy owns a namespaced subfolder
(`bin\Custom\Strategies\NT8SDK\`); it deletes that folder's contents before copying. Orphans
cannot survive a delete-then-copy. This one change alone would have prevented the entire finding.
3. **The manifest records identity, not paths.** SHA-256 of every deployed file, the git SHA and
dirty-flag of the working tree, file sizes, and — critically — a recursive listing with hashes
of every `.cs` file found anywhere under `bin\Custom` at deploy time, so the next deploy can
diff against it and report anything that changed without the deploy's involvement.
4. **The post-deploy verification reads the compiled artifact.** After NinjaTrader recompiles,
`CodeVersion` must change. Record the expected `CodeVersion` nowhere — it is unpredictable — but
record the *previous* one and assert that the first `settings_*.txt` of the next session shows a
different value. A `CodeVersion` that does not change after a deploy means NinjaTrader did not
recompile, and nothing downstream is trustworthy.
5. **One verification script, not two.** `Verify-Deployment.ps1` and `deploy-to-nt8.bat` must share
a single declarative file list. Two hand-maintained lists will always drift; these already have.
6. **Deploy emits a provenance line into the session log.** The strategy already writes
`SESSION START` with mode, account, symbol and risk. It should also write the deployed git SHA
and the SHA-256 of the running `SimpleORBStrategy` type's source. That makes the divergence
visible in the rank-2 artifact (the session log) rather than only in the filesystem.
**The architectural lesson, stated once.** *The repository is not the system.* The authority
hierarchy in §2 now ends with the rule that the deployed artifact outranks the repository, and §4.4
is why. Every architectural claim in the rest of this section is a claim about repository source;
each one is only a claim about running behaviour to the extent that the file it lives in is
verified current in `bin\Custom`. For `NT8StrategyBase.cs` that is *almost* true (one line behind).
For `SimpleORBStrategy.cs` it is false.
### 4.5 The bar-to-trade pipeline, with the guard order
v7.0 called its version of this "the most important diagram in the document". It was not wrong, but
it was incomplete in the one way that mattered: it did not distinguish guards that write to disk
from guards that do not. That distinction is the direct cause of GAP-034 and GAP-064, and it is the
third column of every table below.
Three logging destinations are in play, and they are not equivalent:
| Destination | Method | Where it lands | Survives the session? |
|---|---|---|---|
| **FileLog** | `NT8StrategyBase.FileLog()` (`~1487`) | `…\log\nt8-sdk\session_.log`, prefixed `[HH:mm:ss.fff] ` | **Yes — this is the only on-disk evidence** |
| **Print** | NinjaScript `Print()` | NinjaTrader Output window | No |
| **`_logger`** | `NT8.Core.Logging.BasicLogger` | NinjaTrader Output window (`Log`/stdout) | No |
`FileLog` is additionally gated twice: it no-ops if `_fileLog == null` (i.e. `EnableFileLogging`
false or `InitFileLog()` failed), and every *reject* path routes through `LogRejectRateLimited()`
(`~1524`), which adds two more gates:
```csharp
if (!EnableFileLogging) return;
if (State != State.Realtime && reason != "HistoricalReplayCatchup") return;
...
_rejectCounts[reason]++;
MaybeWriteRejectSummarySnapshot(barTime);
if (_rejectDetailsLogged.Contains(reason)) return; // ← detail line ONCE PER SESSION
_rejectDetailsLogged.Add(reason);
FileLog("REJECT: reason={0} detail={1} bar={2:yyyy-MM-dd HH:mm:ss}");
```
So: **a `REJECT:` detail line appears at most once per reason per session.** Everything after the
first occurrence is counted and reported only through `REJECT SUMMARY:`. An operator reading a log
and seeing one `RthGuard` line is seeing 37 events.
#### 4.5.1 `NT8StrategyBase.OnBarUpdate()` — guards in execution order
`OnBarUpdate()` starts at `NT8StrategyBase.cs:622`. Every early return, in order:
| # | Line | Condition | Reject reason emitted | Disk? | Notes |
|---:|---:|---|---|---|---|
| 1 | 627 | `BarsInProgress != 0` | `WarmupIncomplete` | **FileLog** | Secondary (daily) series updates. Fires on every daily bar. Mislabelled — it is not a warm-up condition. |
| 2 | 641–648 | `State == Realtime && (Now − Time[0]) > 300 s` | `WarmupIncomplete` | **FileLog** | Replay-burst guard. Also mislabelled. |
| 3 | 662–664 | `CurrentBars[1] < 7` | *(none — advisory)* | Print only, every 100th bar | **Deliberately does not return.** NR7 scores neutral 0.3. |
| 4 | 667 | `EnableCMEHolidayGuard && CmeHolidayCalendar.IsHoliday(Time[0].Date)` | `CmeHoliday` | **FileLog** | Reads the **base** copy of the shadowed property — §4.10. |
| 5 | 675 | `!_sdkInitialized \|\| _sdkStrategy == null` | `WarmupIncomplete` | **FileLog** | The only trace that initialisation failed; the failure itself is Print-only (§4.5.4). |
| 6 | 681 | `CurrentBar < BarsRequiredToTrade` | `WarmupIncomplete` | **FileLog** | `BarsRequiredToTrade` is **1**, not 50 — §4.10, Finding 2. |
| 7 | 687 | `Time[0] == _lastBarTime` | `WarmupIncomplete` | **FileLog** | Duplicate bar time. |
| 8 | 693–702 | *(not a return)* new trading date → resets `_runnerActive`, `_breakevenMoved`, signal names, telemetry state | — | — | Session rollover. |
| 9 | 707 | `State == Realtime && !_realtimeBarSeen` | `WarmupIncomplete` | **FileLog** | First live bar is consumed as an eligibility marker; no signal on it. |
| 10 | 715 | *(not a return)* `MaybeWriteRejectSummarySnapshot(Time[0])` | — | — | See §4.12.4 — this is the 11,700-line noise source. |
| 11 | 718 | *(not a return)* `PortfolioRiskManager.UpdateOpenContracts()` | — | — | |
| 12 | 720–722 | `CheckTrailingDrawdownMonitor()` returns true | `TrailingDrawdownBreach` or `TrailingDrawdownNotConfigured` (`~968`) | **FileLog** + `TRAILING_DRAWDOWN_BREACH` line | |
| 13 | 725–741 | `EnableKillSwitch` | `KillSwitch` | **FileLog** | **Flattens and returns every bar thereafter.** Setting this true does not "arm a safety"; it stops trading. See §5.4. |
| 14 | 744 | `!_connectionStateMonitor.TryAllowNewEntry(...)` | delegated to `LogRejectRateLimited` by the monitor | **FileLog** | |
| 15 | 762–786 | `!isTestMode && !isRthBar` where `isRthBar = Time[0].TimeOfDay >= 09:30 && < 16:00` | `RthGuard` | **FileLog** | Emits ETH `STATE:` telemetry from a **fresh context** before returning — §4.12.3. |
| 16 | 789–798 | *(not a return)* bar trace every 100 bars and on the first tradable bar | — | Print only | |
| 17 | 801 | *(not a return)* `DrawDiagnostics()` | — | chart only | |
| 18 | 804–817 | *(deliberately empty)* `_runnerActive` block | — | — | **The GAP-054 fix.** Comment-only; no `SetStopLoss`/`SetTrailStop` here. Verified present. |
| 19 | 820–825 | `Position.Quantity == 0 && _runnerActive` | — | **FileLog** `RUNNER closed — position flat` | Realtime-gated. |
| 20 | 827–851 | `intent = _sdkStrategy.OnBar(barData, context)` → §4.5.2 | | | |
| 21 | 841 | `intent != null` → `ProcessStrategyIntent()` → §4.5.3 | | | |
| 22 | 845 | `intent == null` → `LogSignalRejectionFromContext(context)` | **whatever the strategy recorded** | **FileLog — if and only if the strategy set `signal_reject_reason`** | **This is the hinge of the whole document.** |
| 23 | 847–854 | `catch (Exception ex)` | — | `_logger` + Print + `Log` | Repo adds `FileLog("SDK ONBARUPDATE FAILED: …")` at line 855; **not deployed** (§4.4.3). |
Guard 22 is worth quoting in full, because it is small and it is the mechanism:
```csharp
private void LogSignalRejectionFromContext(StrategyContext context)
{
if (context == null || context.CustomData == null)
return;
if (!context.CustomData.ContainsKey("signal_reject_reason"))
return; // ← the deployed strategy never sets this key
...
LogRejectRateLimited(reason, detail, barTime);
}
```
*(`NT8StrategyBase.cs ~1505–1522`)*
#### 4.5.2 `SimpleORBStrategy.OnBar()` — guards in execution order
Line numbers are the **repository** copy (`src/NT8.Strategies/Examples/SimpleORBStrategy.cs`, 1,531
lines). The **deployed** copy has none of the `RecordSignalRejection` calls, so the "Disk?" column
has two values: what the repository would produce, and what the deployed orphan actually produces.
| # | Line (repo) | Condition | Reject reason recorded | Disk (repo) | **Disk (deployed, actual)** |
|---:|---:|---|---|---|---|
| 1 | 349 | `bar == null` | — | none | none |
| 2 | 351 | `context == null` | — | none | none |
| 3 | 362 | *(not a guard)* `UpdateConfluenceInputs(bar, context)` — writes `avwap`, `avwap_slope`, `trend_confirm*` into `CustomData` | — | — | runs (orphan line 350) |
| 4 | 394–397 | `!testMode && (Session == null \|\| !Session.IsRth)` | `RthGuard` | **FileLog** | **silent** |
| 5 | 401–408 | `!testMode && EnableCMEHolidayGuard && ShouldSkipOrbWindow(date)` | `CmeHoliday` | **FileLog** | **silent** |
| 6 | 429–433 | `bar.Time <= _openingRangeEnd` (ORB window still building) | `OrbRangeNotEstablished` | **FileLog** | **silent** |
| 7 | 436–443 | `!_openingRangeReady` after the window closed / `high <= low` | `OrbRangeNotEstablished` | **FileLog** | **silent** |
| 8 | 466–477 | `_dailyTradeCount >= maxDailyTrades` (pre-rollover path) | `MaxDailyTrades` | **FileLog** | **silent** |
| 9 | 482–493 | `_dailyTradeCount >= maxDailyTrades` (post-rollover path) | `MaxDailyTrades` | **FileLog** | **silent** |
| 10 | 500–505 | *(not a return)* `EnableBarBasedRearm` → clears `_tradeTaken` | — | — | live value **false** |
| 11 | 508–526 | *(not a guard)* `volatilityBuffer = range × (StdDevMultiplier − 1)`; with `StdDevMultiplier = 1.00` this is **0**, so `longTrigger = OrbHigh`, `shortTrigger = OrbLow` exactly | — | — | same |
| 12 | 535–596 | Two-bar pullback confirmation: bar 1 closes beyond the level (`_breakoutBarSeen = true`), bar 2 must close beyond it again; a pullback resets both flags | — | `_logger` only | `_logger` only |
| 13 | 598–601 | `candidate == null` (no confirmed breakout this bar) | `OrbRangeNotEstablished` | **FileLog** | **silent** |
| 14 | 619–650 | Regime veto: `avwap_slope` against direction; short-specific branch when `EnableShortTrendFilter` | `RegimeVeto` | **FileLog** | **silent** |
| 15 | 660–680 | `(int)score.Grade < (int)minGrade` | `GradeFilter` | **FileLog** | **silent** |
| 16 | 681+ | passes → `candidate` returned with `confluence_score`, `trade_grade`, `risk_mode`, multipliers in `Metadata` | — | — | — |
Grade mapping (`NT8.Core/Intelligence/ConfluenceModels.cs:80`): `F=1, D=2, C=3, B=4, A=5, APlus=6`.
`MinTradeGrade = 4` therefore means **Grade B or better**, i.e. weighted score ≥ 0.70
(`MapScoreToGrade`, `ConfluenceScorer.cs:276–299`).
**Runtime evidence, `session_20260908_082122.log` (12,161 lines, 08:21:22 → 19:07:39 ET):**
```
SIGNAL : 0
REJECT: (detail lines) : 3 → HistoricalReplayCatchup, WarmupIncomplete, RthGuard
REJECT SUMMARY: : 11,785
STATE: : 115 (78 of them inside 09:30–16:00)
OrbRangeNotEstablished : 0
GradeFilter : 0
RegimeVeto : 0
MaxDailyTrades : 0
SDK ONBARUPDATE FAILED : 0 (cannot appear — not deployed)
```
Final `REJECT SUMMARY:` block of the session:
```
[19:07:39.505] REJECT SUMMARY: reason=HistoricalReplayCatchup count=81
[19:07:39.505] REJECT SUMMARY: reason=RthGuard count=37
[19:07:39.505] REJECT SUMMARY: reason=WarmupIncomplete count=3
```
121 rejections all session, **not one of them from the strategy**. The 78 RTH bars produced neither
a `SIGNAL:` line nor a `REJECT:` line. `SIGNAL:` is written unconditionally at the top of
`ProcessStrategyIntent()` in realtime (`NT8StrategyBase.cs:2098–2099`), before any risk, portfolio,
direction or sizing check. Zero `SIGNAL:` lines therefore proves `intent == null` on every RTH bar;
zero strategy reject reasons proves the strategy could not say why. That is the complete
observable signature of the deployed-source divergence, and it is airtight.
#### 4.5.3 `ProcessStrategyIntent()` — guards in execution order
`ProcessStrategyIntent()` starts at `NT8StrategyBase.cs:2068`.
| # | Line | Condition | Reject reason | Disk? | Notes |
|---:|---:|---|---|---|---|
| 1 | 2070–2076 | `State == Historical && Account != null` | `HistoricalReplayCatchup` | **FileLog** | **The only reject reason that logs outside realtime.** |
| 2 | 2080–2084 | `State == Realtime && !_realtimeBarSeen` | `WarmupIncomplete` | **FileLog** | Second replay guard, belt-and-braces with OnBarUpdate #9. |
| 3 | 2086–2087 | `!_connectionStateMonitor.TryAllowNewEntry(...)` | delegated | **FileLog** | |
| 4 | 2089–2094 | `_trailingDrawdownHalted \|\| TrailingDrawdownMonitor.IsHalted(account)` | `TrailingDrawdownBreach` | **FileLog** | Latching — once set, blocks for the session. |
| 5 | 2096 | *(not a guard)* `ApplyDynamicStopToIntent(intent, true)` — **rewrites `intent.StopTicks`** | — | Print only | §4.9 |
| 6 | 2098–2099 | *(not a guard)* `FileLog("SIGNAL: {Side} {Symbol} | {banner}")` | — | **FileLog**, realtime-gated | The tripwire. |
| 7 | 2102–2109 | `!PortfolioRiskManager.ValidatePortfolioRisk(...).Allow` | `PortfolioRisk` | **FileLog** | Portfolio kill switch / $2,000 portfolio loss / 6-contract cap |
| 8 | 2112–2119 | `Side == Buy && !EnableLongTrades` | `LongTradesDisabled` | **FileLog** | |
| 9 | 2120–2127 | `Side == Sell && !EnableShortTrades` | `ShortTradesDisabled` | **FileLog** | |
| 10 | 2129 | *(not a guard)* `_positionSizer.CalculateSize(intent, context, _sizingConfig)` | — | Print if verbose | **Sizing happens here — before risk.** §4.9 |
| 11 | 2137–2144 | `sizingResult.Contracts < MinContracts` | `SizeBelowMinContracts` | **FileLog** | |
| 12 | 2149–2159 | `!_riskManager.ValidateOrder(intent, context, _riskConfig, contracts).Allow` | **`MaxTradeRisk`** | **FileLog** | **Mislabelled.** This one bucket also carries "Trading halted by risk manager", "Daily loss limit breached" and "Max open positions exceeded" (`BasicRiskManager.cs:54–160`). The `detail=` text disambiguates; the `REJECT SUMMARY:` counts do not. |
| 13 | 2163–2180 | *(not a guard)* build `OmsOrderRequest`, `SubmitOrderToNT8()`, `_ordersSubmittedToday++` | — | — | |
| 14 | 2186–2196 | `_circuitBreaker != null && !ShouldAllowOrder()` (inside `SubmitOrderToNT8`, non-historical only) | `CircuitBreaker` | **FileLog** | 3 NT8 rejections within 30 s |
| 15 | 2270–2290 | *(not a guard)* `SIGNAL … | Grade= | Score=`, `SIGNAL_DETAIL:`, ` Factors:`, `SUBMIT …` | — | **FileLog**, realtime-gated | The complete pre-trade record |
| 16 | 2294–2341 | `SetStopLoss` / `SetProfitTarget` / `SetTrailStop` then `EnterLong`/`EnterShort` per leg | — | — | §4.8, §4.9 |
| 17 | 2354–2362 | `catch` in `SubmitOrderToNT8` | — | Print + `_logger`, **then rethrows** | The rethrow propagates to `OnBarUpdate`'s catch (#23 above) whose `FileLog` line is not deployed. **A submission failure is currently invisible on disk.** |
#### 4.5.4 Guards that are invisible on disk — the defect class
Collected in one place, because this is the pattern that produced two separate multi-week outages:
| Site | What is lost | Severity |
|---|---|---|
| `OnStateChange`, `State.DataLoaded` catch (`~580–585`) | `InitializeSdkComponents()` throwing → `Print` + `Log` only, no `FileLog`, despite `InitFileLog()` having already run on the line above. The only on-disk trace is a stream of `WarmupIncomplete` rejects with `detail=SdkInitialized=False`. **`RiskEnvelopeValidator` throws here** (§5.4) — a mis-paired risk envelope produces an all-day silent outage. GAP-063. | **HIGH** |
| `SubmitOrderToNT8` catch → `OnBarUpdate` catch | `SDK ONBARUPDATE FAILED` written in the repo, **not deployed**. Order-submission exceptions are Output-window-only. | **HIGH** |
| `DAILY_TRADE_COUNT restored / reset / warning` (`SimpleORBStrategy.cs:1099, 1108, 1114, 1143`) | `_logger` only. The daily-trade-count persistence state — the thing that decides whether the strategy will trade at all today — is never on disk. GAP-055. | **MEDIUM** |
| Pullback-confirmation trace (`SimpleORBStrategy.cs ~541–591`) | `_logger` only. "breakout bar seen, waiting for confirmation" and "breakout failed, pulled back, reset" are the two most diagnostic lines in the strategy and neither reaches disk. | **MEDIUM** |
| Dynamic-stop calculation (`ResolveDynamicStopTicks`, `~1168`) | `Print` only. The actual stop distance used for sizing and for `SetStopLoss` appears on disk only inside the `SUBMIT` line, i.e. only when a trade happens. | **MEDIUM** |
| `ResolveRunnerMode` result (`~2202`) | `Print` only; also recoverable from `SUBMIT … Mode=`. | LOW |
**Doctrine rule (existing, restated).** *If a code path can end a trading day, it must write to
`FileLog`.* `Print` and `_logger` are for development. The Output window is not retained, is not
timestamped consistently, and is not something an operator reviews the next morning. Every entry in
the table above is a violation of a rule this project already wrote down.
### 4.6 The four risk tiers
The design describes four tiers of risk control. Three of the four are implemented; **two of the
four are unreachable from the live path.** This was flagged in earlier reviews and is re-verified
here.
| Tier | Implementation | Lines | Wired into the live path? | Evidence |
|---|---|---:|---|---|
| **Tier 1 — Basic** | `NT8.Core/Risk/BasicRiskManager.cs` | 385 | **Yes** | `_riskManager = new BasicRiskManager(_logger, DailyLossLimit)` — `NT8StrategyBase.cs ~1793` |
| **Tier 2/3 — Advanced** | `NT8.Core/Risk/AdvancedRiskManager.cs` + `AdvancedRiskModels.cs` | ~1,100 | **No — constructed nowhere outside its own folder** | Grep for `AdvancedRiskManager` across all of `src/` excluding `NT8.Core/Risk/`: **zero hits** |
| **Tier 3.5 — Portfolio heat** | `AdvancedRiskManager.ValidatePortfolioHeat()` (`~405–475`) | ~70 | **No — reachable only through Tier 2/3** | Same |
| **Portfolio risk** | `NT8.Core/Risk/PortfolioRiskManager.cs` | 396 | **Yes** | `PortfolioRiskManager.Instance.ValidatePortfolioRisk(Name, intent)` — `NT8StrategyBase.cs:2102` |
| **Trailing drawdown** | `TrailingDrawdownMonitor`, a **private nested class** in `NT8StrategyBase.cs:2622` | ~180 | **Yes, but opt-in and currently off** | `EnableTrailingDrawdown: False` in the 2026-09-08 export |
#### 4.6.1 Tier 1 — `BasicRiskManager`
Four checks, in order, inside `ValidateOrder(intent, context, config, candidateContracts)`
(`BasicRiskManager.cs:54`):
1. **Startup assertion (GAP-003):** `RiskPerTrade > MaxTradeRisk` → `throw ArgumentException`. Note
this is a *throw*, evaluated on every order, not a reject. Live values are `$250` and `$250` —
equal, so it passes, but with zero headroom.
2. `_tradingHalted` → reject `"Trading halted by risk manager"`.
3. `_dailyPnL <= -DailyLossLimit` → sets `_tradingHalted = true`, rejects
`"Daily loss limit breached: {0:C}"`.
4. `CalculateTradeRisk(intent, context, contracts) > MaxTradeRisk` → reject
`"Trade risk too high: {0:C}"`, where
`CalculateTradeRisk = intent.StopTicks × tickValue(symbol) × candidateContracts`
(`BasicRiskManager.cs:172–177`). `tickValue` comes from
`InstrumentTickValueTable` — NQ `$5.00`, MNQ `$0.50`, ES `$12.50`, MES `$1.25`, CL/GC `$10.00`,
6E `$12.50`, 6A `$10.00`.
5. `openPositions >= MaxOpenPositions && context.CurrentPosition.Quantity == 0` → reject
`"Max open positions exceeded: {0}"`.
All four rejections are logged by the caller under the single reason string `MaxTradeRisk`
(`NT8StrategyBase.cs:2155`). **The reject taxonomy collapses four distinct conditions into one
bucket.** GAP-048 is the task that carries this; it remains open.
#### 4.6.2 Tier 2/3 and Tier 3.5 — built, tested, unreachable
`AdvancedRiskManager` implements, in `ValidateOrder`: Tier 1 delegation to `BasicRiskManager`,
weekly loss limit (Tier 2), trailing drawdown limit (Tier 2), cross-strategy exposure (Tier 3),
time-based restrictions (Tier 3), correlation-based limits (Tier 3), and portfolio heat (Tier 3.5,
GAP-019) — `heatPct = (totalOpenRisk + newTradeRisk) / accountBalance × 100`, rejected above
`AdvancedRiskConfig.MaxHeatPct` (default `3.0`).
None of it runs. `InitializeSdkComponents()` constructs `BasicRiskManager` and nothing else. The
same is true of the sizing family: `AdvancedPositionSizer`, `GradeBasedSizer`,
`VolatilityAdjustedSizer` and `OptimalFCalculator` have **zero references anywhere in `src/`
outside `NT8.Core/Sizing/`**. They are referenced only from six test files
(`tests/NT8.Core.Tests/Risk/AdvancedRiskManagerTests.cs`,
`tests/NT8.Core.Tests/Sizing/AdvancedPositionSizer{,Performance}Tests.cs`,
`GradeBasedSizerTests.cs`, `tests/NT8.Integration.Tests/Phase4IntegrationTests.cs`,
`RiskSizingIntegrationTests.cs`).
`GradeBasedSizer` is the sharp edge here: `SimpleORBStrategy` *does* call
`_gradeFilter.GetSizeMultiplier(score.Grade, mode)` and stash `grade_multiplier`,
`mode_multiplier`, `combined_multiplier` in `intent.Metadata`; `SubmitOrderToNT8` *does* print them
in the `SUBMIT` line. **But `BasicPositionSizer` never reads them.** The multipliers are computed,
logged, and discarded. An operator reading `SUBMIT … GradeMult=1.25 ModeMult=1.00 CombinedMult=1.25`
would reasonably conclude the size was scaled by grade. It was not. GAP-050 carries this.
**Counter-recommendation.** Do **not** wire `AdvancedRiskManager` in before Gate Run #3. It adds
six reject conditions to a pipeline that currently cannot report its existing ones, on an account
with one strategy, one instrument and `MaxDailyTrades = 1`, where cross-strategy exposure and
correlation limits are definitionally inert. Fixing the reject taxonomy (GAP-048) and the
deployment model (§4.4) are worth more than any of it.
#### 4.6.3 `PortfolioRiskManager` — a singleton with no operator surface
`ValidatePortfolioRisk` (`PortfolioRiskManager.cs:117`) checks three things:
| Check | Limit | Configurable from the property grid? |
|---|---|---|
| `PortfolioKillSwitch` | `false` at construction | **No** |
| `totalPnL <= -PortfolioDailyLossLimit` | **`$2,000.00`** hard-coded (`:67`) | **No** |
| `totalContracts >= MaxTotalOpenContracts` | **`6`** hard-coded (`:68`) | **No** |
These are public settable properties on the singleton, but nothing in `NT8StrategyBase` or
`SimpleORBNT8` ever sets them, and there is no `[NinjaScriptProperty]` for any of them. With one
registered strategy, `MaxContracts = 3` and `DailyLossLimit = $1,000`, none of the three can bind
before the per-strategy limits do — so the portfolio tier is currently decorative. It becomes
load-bearing the moment a second strategy is registered, at which point the operator will discover
a `$2,000` limit they cannot see or change. Record as `PL-` with trigger: *"a second strategy is
attached to the same account."*
#### 4.6.4 The trailing-drawdown monitor
Implemented as `private class TrailingDrawdownMonitor` nested inside `NT8StrategyBase.cs:2622` —
**not** in `NT8.Core`, therefore not testable by any of the 562 tests, and not visible to any
static analysis MSBuild performs. It is a singleton keyed by account name, with registration in
`InitializeSdkComponents()` / `InitializeTrailingDrawdownState()` and unregistration in
`State.Terminated`.
Behaviour, verified from source:
- Tracks equity, peak, locked peak, reference peak, halt threshold per account.
- `TrailingDrawdownLockOffset` (default `$100`) is the lock-in offset above starting balance;
the comment names Bulenox explicitly and warns other firms differ.
- `TrailingDrawdownHaltBuffer` (default `$2,000`) is the halt distance, deliberately tighter than
`TrailingDrawdownAmount` (`$2,500`) so the strategy halts *before* the firm's trail is reached.
- On breach: `HandleTrailingDrawdownBreach()` (`~1007`) sets `_trailingDrawdownHalted`, emits
`TRAILING_DRAWDOWN_BREACH: Account=… Equity=… Peak=… Floor=… Locked=… Time=…` to **both** Print
and FileLog, records a `TrailingDrawdownBreach` reject, and — **only when
`RiskTier == Conservative`** — writes a persistent halt file. Under `Normal` (the live setting)
and `Aggressive`, a breach is in-memory only and is forgotten on restart.
- `FlattenForTrailingDrawdown()` issues `ExitLong("TrailingDrawdownHalt")` /
`ExitShort("TrailingDrawdownHalt")`.
Live: `EnableTrailingDrawdown: False`, `AccountStartingBalance: $50,000.00`,
`RiskTier: Normal`. The monitor registers but the halt logic never arms. The GAP-046 outage of
2026-08-18 — 27 rejections from 14:30 ET onward on `EnableTrailingDrawdown=True` with
`AccountStartingBalance=$0.00` — is now prevented at startup by `RiskEnvelopeValidator` assertion A
(§5.4), and additionally distinguished at runtime by the separate `TrailingDrawdownNotConfigured`
reason (`NT8StrategyBase.cs:968`).
### 4.7 Confluence scoring — the ten factors
`ConfluenceScorer` (`NT8.Core/Intelligence/ConfluenceScorer.cs`) pre-populates a
`Dictionary _factorWeights` in its constructor (lines 105–117) and resolves
each factor's weight through `ResolveWeight(type, fallbackWeight)` (`~410–419`), which returns the
dictionary value when present — it always is, so each calculator's own weight is unreachable.
GAP-047 Part 2 corrected the five wrong literals. **Verified current, 2026-09-22:**
| # | Factor (`FactorType`) | Calculator class (`FactorCalculators.cs`) | Designed weight | **Current literal** | Runtime weight in the live log |
|---:|---|---|---:|---:|---:|
| 1 | `Setup` | `OrbSetupFactorCalculator` (:31) | 1.00 | `1.0` (:108) | `x1.00` |
| 2 | `Trend` | `TrendAlignmentFactorCalculator` (:116) | 1.00 | `1.0` (:109) | `x1.00` |
| 3 | `Volatility` | `VolatilityRegimeFactorCalculator` (:200) | 1.00 | `1.0` (:110) | `x1.00` |
| 4 | `Timing` | `TimeInSessionFactorCalculator` (:277) | 1.00 | `1.0` (:111) | `x1.00` |
| 5 | `ExecutionQuality` | `ExecutionQualityFactorCalculator` (:336) | 1.00 | `1.0` (:112) | `x1.00` |
| 6 | `NarrowRange` | `NarrowRangeFactorCalculator` (:451) | 0.20 | **`0.20`** (:113) | `x0.20` |
| 7 | `OrbRangeVsAtr` | `OrbRangeVsAtrFactorCalculator` (:581) | 0.15 | **`0.15`** (:114) | `x0.15` |
| 8 | `GapDirectionAlignment` | `GapDirectionAlignmentCalculator` (:699) | 0.15 | **`0.15`** (:115) | `x0.15` |
| 9 | `BreakoutVolumeStrength` | `BreakoutVolumeStrengthCalculator` (:809) | 0.20 | **`0.20`** (:116) | `x0.20` |
| 10 | `PriorDayCloseStrength` | `PriorDayCloseStrengthCalculator` (:909) | 0.15 | **`0.15`** (:117) | `x0.15` |
| | **Total** | | **5.85** | **5.85** | **5.85** |
**GAP-047 Part 2 is live and confirmed in runtime, not merely in source.** From
`session_20260908_082122.log`, 09:30:00 ET:
```
[09:30:00.046] STATE: Regime=Bullish Direction=Buy DirectionSource=DefaultLong Score=0.803 Grade=A
Factors=Setup=0.80x1.00;Trend=0.70x1.00;Volatility=0.70x1.00;Timing=1.00x1.00;
ExecutionQuality=0.80x1.00;NarrowRange=1.00x0.20;OrbRangeVsAtr=0.60x0.15;
GapDirectionAlignment=1.00x0.15;BreakoutVolumeStrength=1.00x0.20;PriorDayCloseStrength=0.40x0.15
```
`ConfluenceScorer` lives in `NT8.Core.dll`, which is current in deployment (2026-08-26 05:16), so
the weights are not affected by the deployed-source divergence.
**Normalisation.** `Score()` (`~149–190`) accumulates
`weightedScoreSum += factor.Score × weight` and `totalWeight += weight`, then
`weightedScore = totalWeight > 0 ? weightedScoreSum / totalWeight : 0`. Normalisation is dynamic —
it divides by whatever weights were actually applied, so the composite stays in `[0,1]` regardless
of which factors a caller supplies. This is why the fix required no compensating change to the
grade thresholds.
**Grade thresholds** (`MapScoreToGrade`, `~276–299`): `≥0.90 A+`, `≥0.80 A`, `≥0.70 B`, `≥0.60 C`,
`≥0.50 D`, else `F`.
**Two structural observations on the factor set.**
1. **The five core factors carry 85.5% of the weight** (5.00 / 5.85). The five factors added in the
GAP-047 era together carry 14.5%, and the largest of them, at 0.20, can move the composite by at
most 0.034. A factor weighted 0.15 can move the composite by at most 0.026 — less than the width
of one grade band divided by four. **Factors 6–10 cannot, individually, change a grade.** That is
a legitimate design (they are tie-breakers), but it should be stated rather than left for someone
to rediscover while tuning.
2. **The `Trend` factor is structurally capped for short trades.** `TrendAlignmentFactorCalculator`
(`~116–186`) is additive: `+0.4` price on the trade's side of AVWAP, `+0.3` AVWAP slope agrees
with direction, `+0.3` `trend_confirm > 0.5`. In the **deployed** strategy,
`context.CustomData["trend_confirm"] = avwapSlope > 0.0 ? 1.0 : 0.0` (orphan line 921) —
unconditionally rewarding a *positive* slope. For a Sell, the `+0.3` slope-aligned bonus requires
`avwapSlope < 0.0`. **The two are mutually exclusive by construction: a short trade can never
score above 0.7 on a 1.00-weighted factor, and scores 0.3 unless price is also below AVWAP.**
The repository copy fixes this (`trend_confirm_long` / `trend_confirm_short`, repo lines
970–972) — and has **0 occurrences in the deployed file**. This is GAP-062, recorded in
`DEC-20260826-01` as "deployed 2026-08-26 by operator request", and **it has never been live**.
§6.3 owns the finding; §4.7 owns the mechanism.
### 4.8 Runner architecture and the `RunnerMode` resolution
#### 4.8.1 The five modes
`ResolveRunnerMode(configured, qty)` (`NT8StrategyBase.cs ~2203–2218`) is a pass-through for every
explicit mode; only `Auto` computes:
| `RunnerActivationMode` | Resolves to | Scaler qty | Runner qty | Protective exits |
|---|---|---|---|---|
| `Auto`, qty ≥ 2 | `Mode1DualLeg` | `qty − 1` | `1` | Scaler: `SetStopLoss` + `SetProfitTarget`. Runner: `SetStopLoss` **then** `SetTrailStop` |
| `Auto`, qty = 1 | `Mode2RunnerOnly` | 0 | `qty` | Runner only: `SetStopLoss` then `SetTrailStop` |
| `Mode1DualLeg` | itself | `qty ≥ 2 ? qty − 1 : qty` | `1` | as above |
| `Mode2RunnerOnly` | itself | 0 | `qty` | runner only |
| `Mode3ScalerOnly` | itself | `qty` | 0 | scaler only |
| `Disabled` | itself | `qty` | 0 | scaler only (single-leg legacy) |
Signal names are `SDK_{Symbol}_S_{12-hex}` and `SDK_{Symbol}_R_{12-hex}` sharing one `baseId`
(`~2290–2293`), which is how scaler and runner legs of the same trade are correlated in
`ORDER`/`FILL` lines and in `trades_*.jsonl`.
**Latent quantity-doubling defect in `Mode1DualLeg`.** When `RunnerActivationMode` is set to
`Mode1DualLeg` *explicitly* and sizing returns `qty = 1`, the ternary yields `scalerQty = 1` and
`runnerQty = 1` — **two contracts submitted for a one-contract signal**, at double the intended
risk. `Auto` never reaches this because it routes qty = 1 to `Mode2RunnerOnly`. `EntriesPerDirection
= 2` means NT8 will happily accept both. Live setting is `Auto`, so this is latent, not active.
Severity **HIGH** if the mode is ever changed; record as `GAP-` with owner `Kilocode`.
*Not verified in runtime* — no session log in the archive shows an explicit `Mode1DualLeg` with
qty = 1. The settling test is a Strategy Analyzer run with `RunnerActivationMode=Mode1DualLeg`,
`MaxContracts=1`, asserting `SUBMIT Scaler=1 Runner=1` never occurs.
**`EnableRunner` does not control the runner.** `ResolveRunnerMode` never consults it. Its only two
uses in the entire codebase are the chart diagnostic label (`~2534`) and the settings-export line
(`SimpleORBNT8.cs:483`). Setting `EnableRunner = false` changes nothing about order submission;
the runner is disabled by setting `RunnerActivationMode = Mode3ScalerOnly` or `Disabled`. The live
export line `Runner : True | Trail=12ticks` is therefore misleading in two ways at once — see §4.10
for the second.
#### 4.8.2 Two `RunnerMode` enums — a type-map hazard
| Declaration | Namespace | Members |
|---|---|---|
| `NT8StrategyBase.cs:42` | `NinjaTrader.NinjaScript.Strategies` | `Auto, Mode1DualLeg, Mode2RunnerOnly, Mode3ScalerOnly, Disabled` |
| `NT8.Core/Common/Models/Configuration.cs:515` | `NT8.Core.Common.Models` | `Auto, Mode1DualLeg, Mode2RunnerOnly, Mode3ScalerOnly, Disabled` |
Identical member names, identical order, identical XML doc comments — and **no conversion code
between them anywhere in `src/`**. The `[NinjaScriptProperty] RunnerActivationMode` binds to the
NinjaScript one; `NT8.Core` code that takes a `RunnerMode` parameter takes the Core one. Today
nothing crosses the boundary, so nothing breaks. The hazard is that the two are trivially
interchangeable to a reader and completely incompatible to the compiler, and that a future
`MultiLevelTargetManager` or `TrailingStopManager` integration will need a mapper that does not
exist. The same pattern, with the same risk, applies to the six duplicate type names in §4.11.
**Doctrine rule.** *A type that must cross the adapter boundary is declared once, in
`NT8.Core`, and the NinjaScript file uses a `using` alias.* `NT8StrategyBase.cs` already does
exactly this for six other types (lines 28–35: `SdkPosition`, `SdkOrderSide`, `SdkOrderType`,
`OmsOrderRequest`, `OmsOrderSide`, `OmsOrderType`, `OmsOrderState`, `OmsOrderStatus`). `RunnerMode`
is the one it duplicated instead.
### 4.9 Dynamic stop and its interaction with sizing
```csharp
protected int ResolveDynamicStopTicks(int configuredStopTicks, Dictionary metadata, bool logCalculation)
{
if (!EnableDynamicStop || CurrentBars == null || CurrentBars.Length == 0 || CurrentBars[0] < AtrPeriod)
return configuredStopTicks;
double atrValue = ATR(Close, AtrPeriod)[0];
int dynStop = (int)Math.Round(atrValue / TickSize * AtrMultiplier);
dynStop = Math.Max(MinStopTicks, Math.Min(MaxStopTicks, dynStop));
if (metadata != null) metadata["current_atr"] = atrValue / TickSize;
if (logCalculation)
Print(String.Format("[SDK] Dynamic stop: ATR={0:F1}t x {1} = {2}t (${3})",
atrValue / TickSize, AtrMultiplier, dynStop, dynStop * 5));
return dynStop;
}
```
*(`NT8StrategyBase.cs ~1154–1173`)*
With the live configuration — `EnableDynamicStop: True`, `AtrPeriod 14`, `AtrMultiplier 1.50`,
`MinStopTicks 12`, `MaxStopTicks 50` — **the strategy's own `StopTicks = 8` is dead.** The
effective stop is always in `[12, 50]` ticks, i.e. `[$60, $250]` on NQ. The settings export's
`StopTicks: 8 / TargetTicks: 16 / StopDollars: $40.00 / TargetDollars: $80.00 / RR_Ratio: 2.00:1`
is **arithmetic on a number that is never used**. The real reward:risk ranges from `16/12 = 1.33:1`
down to `16/50 = 0.32:1`. On the high-ATR days the ORB strategy exists to capture, it is at its
worst.
This is not theoretical. GAP-054's 2026-09-01 trade `SDK_NQ_R_254a84ddcec7` was stopped at
**39 ticks**: `39 × $5.00 = $195.00 + ~$5.76 commission = $200.76`, matching
`PNL_UPDATE DayPnL=($200.76)` exactly and matching a separate 2026-08-27 full-stop loss to the
penny. 39 ticks is `round(ATR/tick × 1.5)` for an ATR of 26 ticks — an ordinary NQ 5-minute ATR.
**Severity HIGH**: the settings export tells the operator the trade risks $40 and targets 2:1; the
trade actually risked $195 at 0.41:1.
#### 4.9.1 The GAP-045/046 ordering fix
The order of operations in `ProcessStrategyIntent` is now, and must remain:
```
1. ApplyDynamicStopToIntent(intent, true) ← intent.StopTicks := ATR-derived
2. FileLog("SIGNAL: …") ← tripwire, after the stop is real
3. PortfolioRiskManager.ValidatePortfolioRisk
4. direction filter
5. _positionSizer.CalculateSize(intent, …) ← reads the ATR-derived StopTicks
6. sizingResult.Contracts < MinContracts?
7. _riskManager.ValidateOrder(intent, …, contracts) ← reads BOTH the real stop AND the real qty
```
Before GAP-045, step 7 ran with an implicit quantity of 1 and `CalculateTradeRisk` had no quantity
term at all (`BasicRiskManager.ValidateOrder(intent, context, config)` — the three-argument
overload at `:46` still exists and still defaults to `1`, kept only for the test suite). The
consequence was recorded on 2026-08-18 at 10:10 ET: five valid Sell signals rejected with
`REJECT: reason=KillSwitch detail=Risk manager rejected: Trade risk too high: $225.00` — a stop of
45 ticks against `MaxTradeRisk=$200`, while `MaxStopTicks=50` ($250) was configured. The top 20% of
the ATR stop range was unreachable, and the days it excluded were exactly the high-ATR days.
Three things the fix achieved, all verified in current source:
1. **Sizing before risk.** `CalculateSize` at line 2129, `ValidateOrder` at line 2149.
2. **Quantity in the risk formula.**
`CalculateTradeRisk = intent.StopTicks × tickValue × candidateContracts` (`:172–177`), with
per-position semantics per `DEC-20260818-19`.
3. **Startup assertions instead of 10:10-ET surprises.** `RiskEnvelopeValidator` (§5.4).
**What it cost to learn.** Two live outages in one day, 2026-08-18: GAP-046 (27 rejections from
14:30 ET, all-day) and GAP-045 (five rejected signals at 10:10 ET). Both were parameter pairs that
were individually valid and jointly impossible. That is the whole reason §5.4 exists as a section.
**The residual, un-asserted interaction.** The startup assertion `MaxStopTicks × tickValue ≤
MaxTradeRisk` is checked at **1 contract**. `CalculateTradeRisk` multiplies by the actual quantity.
So a configuration that passes startup can still reject at runtime whenever
`stopTicks × tickValue × contracts > MaxTradeRisk`. Live: at 3 contracts on NQ the stop must be
≤ 16 ticks, but `MinStopTicks` is 12 and a typical dynamic stop is 25–40. **Sizing will therefore
be pushed down to 1 contract on almost every real trade**, because `BasicPositionSizer`'s
`FixedDollarRisk` path computes `optimalContracts = RiskPerTrade / (StopTicks × tickValue)` —
`$250 / (39 × $5) = 1.28 → 1`. `MaxContracts = 3` is effectively unreachable while
`EnableDynamicStop` is true. That is arguably correct risk behaviour; it is certainly not what the
configuration looks like it says.
### 4.10 Property shadowing and initialisation order — NEW IN v9.0
Two independent defects that compound. Both are latent-to-active in the current live configuration.
#### 4.10.1 Finding 2 — `base.OnStateChange()` is called last
```csharp
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Name = "Simple ORB NT8";
...
BarsRequiredToTrade = 50;
MinTradeGrade = 5;
MaxOpenPositions = 2;
RunnerTrailTicks = 20;
...
}
else if (State == State.Configure) { }
base.OnStateChange(); // ← SimpleORBNT8.cs:163
}
```
The NinjaScript convention — and the convention every other override in this file follows — is to
call `base.OnStateChange()` **first**, then apply subclass specialisation. Here it is last, so the
base's own `SetDefaults` block (`NT8StrategyBase.cs:461–540`) runs **after** the subclass's and
overwrites every property both of them set, using the base's value.
**The four properties this silently overwrites**, with the live-log confirmation:
| Property | `SimpleORBNT8` sets | Line | Base overwrites to | Line | Live 2026-09-08 export |
|---|---:|---:|---:|---:|---|
| `RunnerTrailTicks` | **20** | 143 | **12** | 507 | `Runner : True \| Trail=12ticks` |
| `MinTradeGrade` | **5** (Grade A) | 135 | **4** (Grade B) | 499 | `MinTradeGrade : 4` |
| `MaxOpenPositions` | **2** | 127 | **3** | 485 | `MaxOpenPositions : 3` |
| `BarsRequiredToTrade` | **50** | 134 | **1** | 481 | `BarsRequiredToTrade: 1` |
All four confirmed against `settings_Simple_ORB_NT8_20260908_082122.txt` and against
`session_20260908_082122.log` line 11 (`Historical readiness [DATA LOADED] : BarsRequiredToTrade=1`).
The other 29 properties both classes set happen to carry identical values in both blocks
(`DailyLossLimit 1000`, `MaxTradeRisk 200`, `RiskPerTrade 100`, `MinContracts 1`, `MaxContracts 3`,
`Calculate OnBarClose`, `EnableLongTrades true`, `EnableShortTrades true`, `EnableAutoBreakeven
true`, `BreakevenTriggerTicks 20`, `BreakevenOffsetTicks 1`, `EnableRunner true`,
`StartBehavior AdoptAccountPosition`, and the eight shadowed names), so the bug is invisible
except in exactly those four rows. **That is what made it survive: 88% of the overwrite is a no-op.**
**The deploy script asks the operator to verify an impossible value.** `deploy-to-nt8.bat` step 4:
```
echo 4. Verify defaults: BreakevenTriggerTicks=20 RunnerTrailTicks=20 MaxContracts=3
```
`RunnerTrailTicks=20` is **unsatisfiable from source defaults** — no ordering of these two
`SetDefaults` blocks can produce it, because the base always runs last and always writes 12. Any
operator who followed that instruction and saw 12 would have had to conclude their deploy had
failed. The strategy has been trading a 12-tick trail while its own subclass asked for 20, since
whenever the subclass value was introduced.
**Why this is worse than a wrong number.** `BarsRequiredToTrade = 1` instead of 50 removes the only
warm-up guard on the primary series. Guard #6 of §4.5.1 becomes `CurrentBar < 1`, which is true for
exactly one bar. Indicator warm-up is then governed only by the individual checks inside
`ResolveDynamicStopTicks` (`CurrentBars[0] < AtrPeriod`) and `BuildStrategyContext`
(`CurrentBars[1] >= SmaPeriodLong`). Every other calculator is on its own.
**Remedy.** Move `base.OnStateChange()` to the first statement of the override. This is a one-line
change with a four-value behavioural consequence, and it must not be made silently: moving it makes
the strategy start using `RunnerTrailTicks = 20`, `MinTradeGrade = 5` (Grade **A**, which will cut
trade frequency hard), `MaxOpenPositions = 2` and `BarsRequiredToTrade = 50` on the next restart.
The correct sequence is: move the call, *and* reconcile the two `SetDefaults` blocks so the intended
values are stated once. Carried as a task in §9; owner `Operator + Kilocode`, because the
`MinTradeGrade` change is a trading decision, not a code decision.
#### 4.10.2 Finding 3 — eight properties shadowed without `new`
Eight `[NinjaScriptProperty]` properties are declared in **both** classes, and neither declaration
carries the `new` keyword:
| Property | Base declaration | Base `GroupName` / `Order` | Derived declaration | Derived `GroupName` / `Order` | Distinguishable in the grid? |
|---|---:|---|---:|---|---|
| `EnableBarBasedRearm` | `:327–329` | Exit Management / 12 | `:63–65` | Trade Management / 13 | **Yes** — different group; display text differs by case (`(SIM only)` vs `(SIM Only)`) |
| `EnableShortTrendFilter` | `:331–333` | Trade Management / 13 | `:68–70` | Trade Management / 14 | **No** — identical name and description |
| `EnableCMEHolidayGuard` | `:335–337` | Trade Management / 14 | `:73–75` | Trade Management / 15 | **No** |
| `EnableATRTrailing` | `:340–342` | Exit Management / 15 | `:78–80` | Exit Management / 16 | **No** |
| `ATRTrailingPeriod` | `:344–347` | Exit Management / 16 | `:82–85` | Exit Management / 17 | **No** |
| `ATRTrailingMultiplier` | `:349–352` | Exit Management / 17 | `:87–90` | Exit Management / 18 | **No** |
| `ATRTrailingMinTicks` | `:354–357` | Exit Management / 18 | `:92–95` | Exit Management / 19 | **No** |
| `ATRTrailingMaxTicks` | `:359–362` | Exit Management / 19 | `:97–100` | Exit Management / 20 | **No** |
Note the `Order` collisions this creates: base `ATRTrailingPeriod` is Exit Management / 16 and
derived `EnableATRTrailing` is also Exit Management / 16; the same collision repeats at 17, 18 and
19, and Trade Management collides at 13 and 14. The NinjaTrader property grid's ordering under
duplicate `Order` values within a group is not specified.
**The mechanism.** A derived property declaration with the same name and no `override` hides the
base one. C# emits warning CS0108 ("use the `new` keyword if hiding was intended") — which
NinjaTrader's compile output buries. **The result is two independent backing fields per name.**
Which one a given line of code reads is decided statically by the type of the reference expression:
code inside `NT8StrategyBase` reads `NT8StrategyBase`'s copy; code inside `SimpleORBNT8` reads
`SimpleORBNT8`'s copy. The operator's property grid edits one of them — and which one is exactly
the thing the table above says cannot be determined from the UI for seven of the eight.
**Where each copy is actually consumed** — verified by grepping each name in `NT8StrategyBase.cs`:
| Consumer | Reads | Consequence |
|---|---|---|
| CME holiday guard, `OnBarUpdate` `:667` | **base** copy | The holiday guard ignores the derived setting |
| ATR trailing stop, `SubmitOrderToNT8` `:2321–2328` | **base** copies of all five ATR-trailing properties | The runner's ATR trail ignores the derived settings entirely |
| `BuildStrategyContext` `:1946` → `CustomData["EnableShortTrendFilter"]` | **base** copy | Feeds the regime veto |
| `GetStrategySettingsLines` `:2438–2442` | **base** copies | **`settings_*.txt` reports the base values for all eight** |
| `GetJuly11Params()` `:2947–2951` → `provenance_*.json` | **base** copies | Provenance records the base values |
| `SimpleORBNT8.ConfigureStrategyParameters()` `:431–438` → `_strategyConfig.Parameters` | **derived** copies | The SDK strategy receives the derived values |
So `EnableShortTrendFilter` reaches the SDK strategy by **two different channels carrying two
different backing fields**: `context.CustomData["EnableShortTrendFilter"]` (base) and
`_config.Parameters["EnableShortTrendFilter"]` (derived). `SimpleORBStrategy` reads the
`Parameters` one at repo line 626. Today both are `true` and nothing diverges.
**Why the defect is currently dormant.** Both `SetDefaults` blocks assign identical values to all
eight (`false, true, true, false, 14, 2.0, 8, 60`). The base's assignment runs last and writes the
base copy; the derived assignment ran first and wrote the derived copy. Both end up correct, by
coincidence. **The defect arms the moment an operator changes any of the eight in the property
grid** — at which point exactly one of the two copies changes, the settings export reports the
other, and the ATR-trailing and holiday-guard code paths may or may not honour it.
**Evidence integrity consequence, stated plainly.** `settings_*.txt` is a **rank 3** artifact in the
authority hierarchy. For these eight properties it reports a value that is not necessarily the value
the operator set. **Eight of the 61 properties in the configuration contract are not
reliably observable from any artifact this project produces.** That is a bigger problem than the
shadowing itself.
**Why `new` was not used.** Nothing in the source suggests deliberate shadowing: the derived
declarations are verbatim copies of the base ones — same types, same `[Range]` attributes, same
descriptions, `Order` values incremented by one, one `Display` string differing only in the case of
a single letter. This is the signature of copy-paste during the GAP-006/008/009/010 batch, into a
file whose author did not have the base file open. `new` was not omitted as a choice; the collision
was never noticed, because MSBuild never compiles either file (§4.1) and NinjaTrader's CS0108
warnings scroll past in the Output window during a 347-file recompile.
**The correct pattern**, in order of preference:
1. **Declare once, in the base.** The derived class deletes its eight declarations. The base's
`[NinjaScriptProperty]` is inherited and appears once in the grid. This is what the other 38 base
properties already do, and `SimpleORBNT8` already reads them (`DailyLossLimit`, `MaxContracts`,
`MinTradeGrade` and so on) with no local declaration.
2. If a subclass genuinely needs a different default, set it in the subclass's `SetDefaults` —
**which requires Finding 2 to be fixed first**, or the base will overwrite it.
3. If a subclass genuinely needs different *semantics*, make the base property `virtual` and
`override` it. Never `new`.
`new` would silence the compiler warning while preserving every one of the defects above. **`new`
is the wrong fix here**, and should be explicitly ruled out in the task that carries this, so that
nobody "fixes the warning" and closes the item.
### 4.11 OMS and execution subsystems
Two adjacent subsystems in `NT8.Core`, 6,265 lines between them, of which the live path uses
roughly 350.
| `NT8.Core/OMS/` | Lines | On the live path? |
|---|---:|---|
| `BasicOrderManager.cs` | 998 | No |
| `OrderModels.cs` | 866 | **Types only** — `OrderRequest`, `OrderSide`, `OrderType`, `OrderState`, `OrderStatus` are aliased into `NT8StrategyBase.cs` (lines 31–35) |
| `OrderTypeValidator.cs` | 376 | No |
| `OrderStateMachine.cs` | 314 | No |
| `IOrderManager.cs` | 84 | No |
| `INT8OrderAdapter.cs` | 56 | No — declared, never implemented on the hot path (§4.3) |
| `NT8.Core/Execution/` | Lines | On the live path? |
|---|---:|---|
| `MultiLevelTargetManager.cs` | 460 | No |
| `ExecutionQualityTracker.cs` | 437 | Indirectly — `ExecutionQualityFactorCalculator` scores from it |
| `ContractRollHandler.cs` | 426 | No |
| `TrailingStopManager.cs` | 411 | **No** — the runner trail is NinjaScript `SetTrailStop`, not this |
| `ExecutionCircuitBreaker.cs` | 346 | **Yes** — `new ExecutionCircuitBreaker(_logger, 3, 30 s)` |
| `ExecutionModels.cs` | 296 | Types |
| `RMultipleCalculator.cs` | 268 | No |
| `OrderRoutingModels.cs` | 253 | No |
| `StopsTargetsModels.cs` | 252 | Types |
| `DuplicateOrderDetector.cs` | 220 | No |
| `SlippageCalculator.cs` | 202 | No |
**`TrailingStopManager` is the one to note.** 411 lines of platform-neutral, unit-testable trailing
logic sit unused while the runner trail is delegated to NinjaScript's `SetTrailStop` — the exact
mechanism that GAP-054 says is not protecting trades (§4.9, and the open question in §6). The
project has a testable implementation of the thing it cannot currently make work. That is worth an
`O-` optimisation entry, with the honest caveat that moving the trail into managed SDK code means
owning intrabar stop management in `OnBarUpdate` at `Calculate.OnBarClose`, which is strictly worse
resolution than NT8's native tick-by-tick trail. **Counter-recommendation: do not migrate the trail
to `TrailingStopManager` to fix GAP-054.** Diagnose GAP-054 first; if the cause is the
`SetStopLoss`-then-`SetTrailStop` ordering (§4.9.1's open question), the fix is one deleted line,
not 411 adopted ones.
**Duplicate type names across namespaces.** Verified this session; every pair below is two distinct
CLR types with the same simple name, no conversion code between them:
| Simple name | Declaration A | Declaration B |
|---|---|---|
| `OrderSide` | `NT8.Core/Common/Models/StrategyIntent.cs:110` | `NT8.Core/OMS/OrderModels.cs:11` |
| `OrderType` | `NT8.Core/Common/Models/StrategyIntent.cs:131` | `NT8.Core/OMS/OrderModels.cs:20` |
| `OrderFill` | `NT8.Core/Common/Models/Configuration.cs:453` | `NT8.Core/OMS/OrderModels.cs:253` |
| `TrailingStopConfig` | `NT8.Core/Execution/StopsTargetsModels.cs:74` | `NT8.Core/OMS/OrderModels.cs:773` |
| `RiskMode` | `NT8.Core/Intelligence/RiskModeModels.cs:9` | `NT8.Core/Risk/AdvancedRiskModels.cs:9` |
| `VolatilityRegime` | `NT8.Core/Intelligence/RegimeModels.cs:9` | `NT8.Core/Sizing/SizingModels.cs:295` |
| `RunnerMode` | `NT8.Core/Common/Models/Configuration.cs:515` | `NT8StrategyBase.cs:42` (§4.8.2) |
`OrderSide` and `OrderType` at least have explicit mappers — `MapOrderSide` and `MapOrderType`
(`NT8StrategyBase.cs ~2366–2382`) — because the boundary is crossed on every order. The other five
pairs have none, which is safe only for as long as nothing crosses. Severity **MEDIUM**: no active
defect, high latent cost, and a direct tax on every reader of this codebase. Carry as `GAP-` with a
scoped remedy: keep the `OMS` pair (they are a genuinely separate order-lifecycle vocabulary) and
alias them everywhere as `NT8StrategyBase.cs` already does; collapse `RiskMode`,
`VolatilityRegime`, `TrailingStopConfig` and `RunnerMode` to one declaration each.
### 4.12 Telemetry and log-line schema
Everything the system writes to disk goes through one method:
```csharp
private void FileLog(string message)
{
if (_fileLog == null) return;
lock (_fileLock)
{
try { _fileLog.WriteLine(string.Format("[{0:HH:mm:ss.fff}] {1}", DateTime.Now, message)); }
catch { }
}
}
```
*(`NT8StrategyBase.cs ~1487–1502`)*
Three properties of that method matter more than any individual line format:
- **Every on-disk line is prefixed `[HH:mm:ss.fff] `** — wall-clock, not bar time. Bar time appears
only where a format string puts it there (`REJECT:` does; `STATE:` does not).
- **There is no date on any line.** The date lives only in the filename
(`session_yyyyMMdd_HHmmss.log`) and in the `SESSION START` line. A log spanning midnight is
ambiguous.
- **The `catch { }` is silent.** A write failure — disk full, file handle lost, permission change —
produces nothing anywhere. `_fileLog` is opened with `AutoFlush = true` (`InitFileLog`, `~1456`),
so partial loss is unlikely, but total silent loss is possible and undetectable.
`_fileLog` is null when `EnableFileLogging` is false, or when `InitFileLog()` threw — in which case
the only trace is `Print("[NT8-SDK] Failed to open file log: …")` in the Output window
(`~1460–1462`). **If the log directory is unwritable, the strategy trades with no record and says
nothing an operator will see.** Severity **HIGH**; carry as `GAP-`.
#### 4.12.1 The complete on-disk line schema
"Realtime-gated" means the emitting site is wrapped in `State == State.Realtime` (or the method
returns early unless realtime). Lines that are not gated also appear in Strategy Analyzer backtests.
| Line | Exact format string | Emitted at | Disk? | Realtime-gated? |
|---|---|---|---|---|
| `SETTINGS FILE: …` | `"SETTINGS FILE: {0}"` | `:2498` | FileLog | No |
| `=== SESSION START … ===` | `"=== SESSION START " + Now("yyyy-MM-dd HH:mm:ss") + " ==="` | `:1620` | FileLog | No |
| `Mode : …` | `"Mode : {0}"` — `BACKTEST` or `LIVE/SIM` | `:1621` | FileLog | No |
| `Strategy :` / `Account :` / `Symbol :` | `"{label}: {0}"` | `:1622–1624` | FileLog | No |
| `Risk : …` | `"Risk : DailyLimit=${0} MaxTradeRisk=${1} RiskPerTrade=${2}"` | `:1625` | FileLog | No |
| `Sizing : …` | `"Sizing : MinContracts={0} MaxContracts={1}"` | `:1629` | FileLog | No |
| `VerboseLog : …` | `"VerboseLog : {0} FileLog: {1}"` | `:1630` | FileLog | No |
| `ConnectionLost : …` | `"ConnectionLost : {0}"` | `:1631` | FileLog | No |
| `Historical readiness […] : …` | `"Historical readiness [{0}] : BarsRequiredToTrade={1}"` | `:1638` | FileLog | No — emitted at DATA LOADED **and** REALTIME ELIGIBILITY |
| `DataSeries[n] : …` | `"DataSeries[{0}] : Type={1} DaysToLoad={2} HistoricalBarsLoaded={3}"` | `:1663` | FileLog | No |
| `WARNING: DataSeries[0] DaysToLoad below 30…` | `"WARNING: DataSeries[0] DaysToLoad below 30; DaysToLoad={0}. Advisory only; trading is not blocked."` | `:1679` | FileLog | No — **see §4.12.5, the number it tests is not what it claims** |
| `FactorWarmup : …` | `"FactorWarmup : NarrowRangeFactorCalculator={0} ({1}/7 daily bars) OrbRangeVsAtrFactorCalculator={2} ({1}/5 daily bars)"` | `:1691` | FileLog | No |
| `WARNING: EnableKillSwitch=False for gate account …` | `"WARNING: EnableKillSwitch=False for gate account {0}."` | `:1709` | FileLog | No — **the advice is wrong, §5.4** |
| `STATE: …` | `"STATE: Regime={0} Direction={1} DirectionSource={2} Score={3:F3} Grade={4} Factors={5}"` | `:1071` | FileLog | **Yes** — `MaybeWriteStateTelemetry` returns unless `EnableStateTelemetry && EnableFileLogging && State == Realtime` |
| `STATE_DETAIL: …` | `"STATE_DETAIL: {0}"` | `:1080` | FileLog | Yes |
| `STATE_CONTEXT: …` | `"STATE_CONTEXT: {0}"` | `:1085` | FileLog | Yes |
| `SIGNAL: …` | `"SIGNAL: {0} {1} \| {2}"` — Side, Symbol, `LIVE MODE`/`TEST MODE ACTIVE` | `:2099` | FileLog | **Yes** |
| `SIGNAL … \| Grade= \| Score=` | `"SIGNAL {0} \| Grade={1} \| Score={2}"` | `:2278` | FileLog | Yes |
| `SIGNAL_DETAIL: …` | `"SIGNAL_DETAIL: {0}"` | `:2280` | FileLog | Yes |
| ` Factors: …` | `" Factors: {0}"` (two leading spaces) | `:2282` | FileLog | Yes |
| `SUBMIT …` | `"SUBMIT Scaler={0} Runner={1} Stop={2} Target={3} Mode={4} BaseTarget={5} DynamicTarget={6} GradeMult={7} ModeMult={8} CombinedMult={9}"` | `:2283` | FileLog | Yes |
| `ORDER …` | `"ORDER {0} State={1} Filled={2}/{3} AvgFillPrice={4:F2}"` | `:1290` | FileLog | Yes — and only for order names starting `SDK_` |
| `FILL …` | `"FILL {0} {1} @ {2:F2} \| OrderId={3} Signal={4}"` | `:1336` | FileLog | Yes — `if (State != State.Realtime) return;` above it |
| `PNL_UPDATE …` | `"PNL_UPDATE DayPnL={0:C} Position={1} Qty={2}"` | `:1388` | FileLog | Yes |
| `POSITION FLAT — …` | `"POSITION FLAT — daily trade count remains active until session rollover"` | `:1397` | FileLog | Yes |
| `RUNNER closed — position flat` | literal | `:824` | FileLog | Yes — plus `_runnerSignalName` non-empty |
| `REJECT: …` | `"REJECT: reason={0} detail={1} bar={2:yyyy-MM-dd HH:mm:ss}"` | `:1548` | FileLog | Yes — **except `HistoricalReplayCatchup`**; and **once per reason per session** |
| `REJECT SUMMARY: …` | `"REJECT SUMMARY: reason={0} count={1}"` | `:1560` | FileLog | Inherits the reject gating; see §4.12.4 |
| `TRAILING_DRAWDOWN_BREACH: …` | `"TRAILING_DRAWDOWN_BREACH: Account={0} Equity={1:F2} Peak={2:F2} Floor={3:F2} Locked={4} Time={5:yyyy-MM-dd HH:mm:ss}"` | `:1014` | Print **and** FileLog | No |
| `TRAILING_DRAWDOWN_HALTED: …` | `"TRAILING_DRAWDOWN_HALTED: Account={0} persisted halt file present at {1}; delete file manually to resume."` | `:1850` | Print + FileLog | No |
| `TRAILING_DRAWDOWN_HALT_FILE: …` | `"TRAILING_DRAWDOWN_HALT_FILE: Account={0} Path={1}"` | `:1911` | FileLog | No — `RiskTier.Conservative` only |
| `TIER_UPGRADE_SUGGESTED: …` | `"TIER_UPGRADE_SUGGESTED: Balance={0:F2} crossed threshold={1:F2}; review RiskTier setting."` | `:879` | Print + FileLog | **Yes** — `MonitorMicroAccountUpgrade` returns unless `State == Realtime` |
| `MICRO_UPGRADE_SUGGESTED warning: …` | two variants, read-failure `:912` and write-failure `:954` | Print + FileLog | Yes |
| `CONNECTION RESTORED at …` | `"CONNECTION RESTORED at {0}"` (HH:mm:ss) | `:1422` | Print + FileLog | No — `OnConnectionStatusUpdate`, edge-triggered |
| `CONNECTION LOST at … Status=…` | `"CONNECTION LOST at {0} Status={1}"` | `:1433` | Print + FileLog | No — edge-triggered |
| `[NT8-SDK] WARNING: LogDirectory is blank…` | `"[NT8-SDK] WARNING: LogDirectory is blank; using default log directory for {0}: {1}"` | `:1482` | Print + FileLog | No |
| `--- ` / `=== SESSION END … ===` | `"=== SESSION END " + Now + " ==="` | `:1730` | FileLog | No — `State.Terminated` |
| **`SDK ONBARUPDATE FAILED: …`** | `"SDK ONBARUPDATE FAILED: {0}: {1}"` — exception type and message | repo `:855` | FileLog | No |
**`SDK ONBARUPDATE FAILED` is written-but-not-yet-deployed.** It is the entire content of the
one-line diff between the repository copy of `NT8StrategyBase.cs` and the copy in
`bin\Custom\Strategies\` (§4.4.3). It has never been compiled into `NinjaTrader.Custom.dll` and
cannot appear in any session log produced to date. **Zero occurrences of it in a log is not
evidence that `OnBarUpdate()` did not throw.** Anyone reasoning from the 2026-09-08 session must
treat "did `OnBarUpdate` throw?" as an open question, not a settled one. This is the single
highest-value uncommitted change in the working tree.
Lines that never reach disk at all, and are therefore absent from every artifact this project
retains: `DAILY_TRADE_COUNT restored/reset/warning` (`SimpleORBStrategy.cs:1099, 1108, 1114, 1143`
— `_logger` only), the pullback-confirmation trace, `[SDK] Dynamic stop: …`,
`[SDK] Runner mode resolved: …`, `[SDK] ATR Trail: …`, `[SDK-DIAG] SetDefaults check: …`,
`[SDK ERROR] Initialization failed: …`. See §4.5.4.
#### 4.12.2 What a healthy trading day looks like on disk
For calibration, the expected line sequence for one complete trade:
```
[hh:mm:ss.fff] STATE: Regime=… Direction=… Score=… Grade=… Factors=…
[hh:mm:ss.fff] STATE_DETAIL: …
[hh:mm:ss.fff] STATE_CONTEXT: OrbHigh=… OrbLow=… OrbReady=True Avwap=… AvwapSlope=… TrendConfirm=… RecommendedContracts=…
[hh:mm:ss.fff] SIGNAL: Buy NQ | LIVE MODE
[hh:mm:ss.fff] SIGNAL Buy | Grade=A | Score=0.812
[hh:mm:ss.fff] SIGNAL_DETAIL: Setup="…" Trend="…" …
[hh:mm:ss.fff] Factors: Setup=0.80 Trend=0.70 …
[hh:mm:ss.fff] SUBMIT Scaler=0 Runner=1 Stop=39 Target=16 Mode=Mode2RunnerOnly BaseTarget=… …
[hh:mm:ss.fff] ORDER SDK_NQ_R_xxxxxxxxxxxx State=Working Filled=0/1 AvgFillPrice=0.00
[hh:mm:ss.fff] FILL Long 1 @ 29164.00 | OrderId=… Signal=SDK_NQ_R_xxxxxxxxxxxx
[hh:mm:ss.fff] PNL_UPDATE DayPnL=$0.00 Position=Long Qty=1
…
[hh:mm:ss.fff] PNL_UPDATE DayPnL=($200.76) Position=Flat Qty=0
[hh:mm:ss.fff] POSITION FLAT — daily trade count remains active until session rollover
[hh:mm:ss.fff] RUNNER closed — position flat
```
The 2026-09-08 session contains **none** of these from `SIGNAL:` onward — zero occurrences of
`SIGNAL`, `SUBMIT`, `ORDER `, `FILL `, `PNL_UPDATE` and `RUNNER closed`.
#### 4.12.3 The ETH telemetry path emits a different, weaker `STATE:` line — and does not say so
This is new in v9.0 and materially changes how the `STATE:` corpus should be read.
`OnBarUpdate` guard #15 (§4.5.1) returns early on non-RTH bars, and when `EnableEthTelemetry` is
true it first does:
```csharp
BarData ethBarData = ConvertCurrentBar();
StrategyContext ethContext = BuildStrategyContext();
MaybeWriteStateTelemetry(ethBarData, ethContext);
```
*(`NT8StrategyBase.cs ~773–777`)*
`ethContext` is **freshly built and never passed through `_sdkStrategy.OnBar()`**. Inside RTH, by
contrast, `MaybeWriteStateTelemetry(barData, context)` is called with the *same* `context` object
that `OnBar` has just mutated — and `SimpleORBStrategy.UpdateConfluenceInputs()` is the first
statement of `OnBar`, writing `avwap`, `avwap_slope` and `trend_confirm` into `CustomData`.
So an ETH `STATE:` line is computed from a context with no AVWAP keys at all.
`TrendAlignmentFactorCalculator` falls back to `GetDouble(CustomData, "avwap_slope", 0.0)`
(`FactorCalculators.cs:146`) and returns 0.00 unconditionally. Confirmed in the live log — the same
session, the same strategy, ninety minutes apart:
```
[08:30:00.137] STATE: Regime=Bullish Direction=Sell DirectionSource=OpeningRangeMidpoint Score=0.523 Grade=D
Factors=Setup=0.70x1.00;Trend=0.00x1.00;…
[08:30:00.145] STATE_CONTEXT: OrbHigh=29691.75 OrbLow=29554.50 OrbWindowStart=09:30 OrbWindowEnd=10:00
OrbReady=True RecommendedContracts=1
[10:05:00.104] STATE_CONTEXT: OrbHigh=29686.50 OrbLow=29455.25 OrbWindowStart=09:30 OrbWindowEnd=10:00
OrbReady=True Avwap=28374.59 AvwapSlope=0.2442 TrendConfirm=1.0 RecommendedContracts=1
```
`AvwapSlope` appears on **71 of 108** `STATE_CONTEXT` lines in the session — the RTH ones — and
never on an ETH one. Every ETH `STATE:` line in the archive reports `Trend=0.00` and a composite
score depressed by exactly `1.00/5.85 × (true Trend score)`, i.e. by up to 0.17 of grade. **ETH
`STATE:` grades are not comparable to RTH `STATE:` grades and must never be pooled with them in any
frequency or grade-distribution study.** Several earlier analyses of "what grade do our setups
reach" drew on the full `STATE:` corpus. Those need re-running on RTH-only lines.
Two further reading rules for `STATE:`, both verified:
- **`STATE_CONTEXT: RecommendedContracts=1` on its own means `OpeningRangeReady == false`.**
`SimpleORBNT8.GetStateTelemetryContextFields()` (`:356–374`) returns `null` when
`!sdkOrb.OpeningRangeReady || OrbHigh <= OrbLow`; the base then still appends
`RecommendedContracts`. A bare `RecommendedContracts=1` line is a *negative* ORB readiness signal,
and it is easy to misread as "no context available". On 2026-09-08 the first three RTH lines
(09:30, 09:35, 09:40) are bare; the ORB window had not closed.
- **The telemetry intent is synthetic.** `BuildStateTelemetryIntent` constructs a side from
`sdkOrb.PendingBreakoutDirection`, defaulting to `Buy` with `DirectionSource=DefaultLong` when
there is no pending breakout. The 78 RTH `STATE:` lines of 2026-09-08 read
`Direction=Buy DirectionSource=DefaultLong Score=0.803 Grade=A` — **Grade A, above
`MinTradeGrade=4`.** That is a score for a hypothetical long, not for a setup that existed.
It does not prove a tradable A-grade opportunity was rejected. It does mean **grade was not the
binding constraint that day**, which is the point that matters for GAP-034: the proposal to close
GAP-034 as "correct Grade-A filtering" is not supported by this evidence and must not be adopted.
#### 4.12.4 `REJECT SUMMARY:` is 97% of the log, and the count it prints is not the count it seems
`session_20260908_082122.log` is 12,161 lines. **11,785 of them are `REJECT SUMMARY:`.** Only 3 are
`REJECT:` detail lines, and 11,696 of the 12,161 were written inside a single second,
08:21:22–08:21:30.
The v9.0 briefing describes this as "11,709 `HistoricalReplayCatchup` events". **That is not what
happened, and the correction matters.** The highest `count=` value anywhere in the file is **81**.
`_rejectCounts` is cleared only by `ResetRejectTracking()`, which is called once per session from
`WriteSessionHeader()` (`:1619`), so counts are monotonic within a session. The session's true
totals are the final block:
```
[19:07:39.505] REJECT SUMMARY: reason=HistoricalReplayCatchup count=81
[19:07:39.505] REJECT SUMMARY: reason=RthGuard count=37
[19:07:39.505] REJECT SUMMARY: reason=WarmupIncomplete count=3
```
**121 rejections in the whole session. 11,785 lines reporting them.**
Mechanism, from `MaybeWriteRejectSummarySnapshot` (`:1564–1589`):
```csharp
if (_rejectCounts.Count == 0) return;
if (IsRejectSummarySnapshotSuppressed(barTime)) return; // 09:30–10:00 only
DateTime tradingDate = barTime.Date;
if (_rejectSummarySnapshotTradingDate != tradingDate) { _rejectSummarySnapshotTradingDate = tradingDate;
_orbRejectSummarySnapshotWritten = false; }
bool dueAfterOrbWindow = !_orbRejectSummarySnapshotWritten;
bool dueInterval = _lastRejectSummarySnapshotTime != DateTime.MinValue
&& (barTime - _lastRejectSummarySnapshotTime).TotalMinutes >= 15; // REJECT_SUMMARY_SNAPSHOT_INTERVAL_MINUTES
if (!dueAfterOrbWindow && !dueInterval) return;
WriteRejectSummary();
```
The interval is measured in **bar time**, and it is called from `OnBarUpdate` (`:715`) on every
bar. During the historical replay burst, bar time advances five minutes per bar across 36,303
loaded bars, so `dueInterval` is satisfied on roughly every third bar, and `dueAfterOrbWindow` fires
again on every new trading date. Expected line count: approximately
`36,303 × (1 − 30min/1440min) / 3 ≈ 11,800`. Observed: **11,696.** The mechanism is quantitatively
confirmed. Once realtime begins the behaviour is correct — 116 lines from 08:30 to 19:07, cleanly
every 15 minutes.
**Consequences.** (a) Any `grep -c` on a reject reason over-counts by two orders of magnitude; use
the final `REJECT SUMMARY:` block, or `sort -u` the counts and take the maximum. (b) 97% of the
archive's bytes are duplicated telemetry, which is why these logs are slow to read and expensive to
scan. (c) The `[08:21:22.xxx]` timestamps make the burst *look* like a violent event; it is one
second of logging, not one second of trading. Severity **MEDIUM**, cost mostly to human attention;
carry as `GAP-` with the remedy "gate `MaybeWriteRejectSummarySnapshot` on `State == Realtime`" —
one condition, no behavioural change.
#### 4.12.5 `DataSeries[0] DaysToLoad=5` against 36,303 bars
The session header reports:
```
[08:21:22.514] DataSeries[0] : Type=MinuteBarsType DaysToLoad=5 HistoricalBarsLoaded=36303
[08:21:22.514] WARNING: DataSeries[0] DaysToLoad below 30; DaysToLoad=5. Advisory only; trading is not blocked.
[08:21:22.514] DataSeries[1] : Type=DayBarsType DaysToLoad=365 HistoricalBarsLoaded=133
```
36,303 five-minute bars is roughly 126 sessions, not 5 days, and the replay burst's oldest bar is
`2026-03-06 10:20:00` — six months back. The reported value comes from
`BarsArray[i].BarsType.DaysToLoad` (`:1658`), which is the **bars *type*'s default**, not the
chart's configured data load. The chart's own Data Series setting governs what NinjaTrader actually
loads, and this code never reads it. **The advisory is therefore comparing a constant against a
constant and can never be satisfied for `MinuteBarsType`.** Every session log in the archive carries
this warning; none of them mean anything by it.
Marked as reasoned from source and corroborated by the bar count, **not directly verified**: the
settling test is to open the chart's Data Series dialog and compare its "Days to load" / "Bars to
load" value with the 36,303 figure. Until that is done, treat the `DaysToLoad` field in every
session header as unreliable. Carry as `GAP-`; the remedy is to log `BarsArray[i].Count`,
`BarsArray[i].GetTime(0)` and the primary series' configured load, and to drop the 30-day advisory
entirely rather than fix its threshold.
The daily series is added by the base at `State.Configure` — `AddDataSeries(BarsPeriodType.Day, 1)`
(`:544`) — and loads 133 bars, comfortably above the 7 needed by `NarrowRangeFactorCalculator` and
the 5 needed by `OrbRangeVsAtrFactorCalculator`. **Factor warm-up has never been the constraint**,
and the `FactorWarmup : … SATISFIED` line confirms it in every session.
## 5. PARAMETER REFERENCE
### 5.1 How to read these tables
**Provenance rule.** Every value in §5 was read from source on the device during this session
(2026-09-22), from `src/NT8.Adapters/Strategies/NT8StrategyBase.cs` and
`src/NT8.Adapters/Strategies/SimpleORBNT8.cs`. Every live value was read from
`settings_Simple_ORB_NT8_20260908_082122.txt`. **Nothing has been carried forward from v7.0 or
v8.0.** Where a value could not be determined from an artifact, the cell says so rather than
guessing.
**Scope.** 46 `[NinjaScriptProperty]` properties on `NT8StrategyBase` and 15 on `SimpleORBNT8`
— 61 declarations, of which 8 are duplicate names (§4.10.2), so **53 distinct operator-facing
settings**. Grouped below by `GroupName` exactly as the NinjaTrader property grid groups them.
**The four columns.**
| Column | Meaning |
|---|---|
| **Source default (base)** | The literal assigned in `NT8StrategyBase.OnStateChange()`'s `State.SetDefaults` block (`:461–540`). Blank if the base does not declare the property. |
| **Source default (ORB subclass)** | The literal assigned in `SimpleORBNT8.OnStateChange()`'s `State.SetDefaults` block (`:114–157`). Blank if the subclass does not set it. |
| **Effective after init** | **New in v9.0.** The value actually held when `State.DataLoaded` runs and `InitializeSdkComponents()` reads it, for a strategy freshly added to a chart with no saved workspace. |
| **Live 2026-09-08** | The value in the settings export for the last recorded session. `—` means the export does not print this property at all. |
**Why the third column exists.** Because of Finding 2 (§4.10.1): `SimpleORBNT8` calls
`base.OnStateChange()` **last**, so the base's `SetDefaults` overwrites the subclass's. For four
properties the effective value is the base's, not the subclass's. Before v9.0 this document
presented the subclass default as the operative one. It was wrong for four rows, and one of those
rows — `RunnerTrailTicks` — is a live trading parameter that the deploy script tells the operator to
verify as a value it can never hold.
**Bolding.** Rows are bolded where the **effective** value differs from what the subclass asked for,
**or** where the **live** value differs from the effective source default. A bolded row is a row
where reading the source alone will mislead you.
**Two properties of the export you must know before using column 4.**
1. **The export omits 14 properties.** `GetStrategySettingsLines()` (`:2395–2470`) prints a
hand-maintained list. `EnableSDK`, `EnableChartDiagnostics`, `AtrPeriod`, `MinStopTicks`,
`MaxStopTicks`, `ATRTrailingPeriod`, `ATRTrailingMinTicks`, `ATRTrailingMaxTicks`, `RegimeGate`,
`SmaPeriodShort`, `SmaPeriodLong`, `EnableRunner`, `EnableAutoBreakeven`, `BreakevenOffsetTicks`
are either absent or appear only inside a composite ORB line. **There is no artifact that records
their live values.**
2. **For the 8 shadowed properties the export prints the *base* copy** (`:2438–2442`), which is not
necessarily the copy the operator edited (§4.10.2). Column 4 for those rows is marked
`(base copy)`.
`[Range]` is `System.ComponentModel.DataAnnotations.RangeAttribute`. NinjaTrader enforces it in the
property grid; it does **not** enforce it on values loaded from a saved workspace, so an
out-of-range value can survive a workspace restore.
### 5.2 `GroupName = "SDK"`
| Property | Type | `[Range]` | Order | Source (base) | Source (ORB) | Effective | Live 2026-09-08 | Browsable | What it actually does |
|---|---|---|---:|---|---|---|---|---|---|
| `EnableSDK` | `bool` | — | 1 | `true` | — | `true` | **—** (not exported) | yes | Master switch. If false, `State.DataLoaded` skips `InitFileLog()`, `InitializeSdkComponents()` and `InitializeTrailingDrawdownState()` entirely, `_sdkInitialized` stays false, and every bar exits at `OnBarUpdate` guard #5. A false value produces **no session log at all** — not an empty one, none. |
`EnableSDK = false` is the single most complete off-switch in the system and the only one whose
effect is indistinguishable from "the strategy was never started". It is not in the settings export
because the settings export is written by the code path that only runs when it is true.
### 5.3 `GroupName = "Risk"`
| Property | Type | `[Range]` | Order | Source (base) | Source (ORB) | Effective | Live 2026-09-08 | Browsable | What it actually does |
|---|---|---|---:|---|---|---|---|---|---|
| `DailyLossLimit` | `double` | — | 1 | `1000.0` | `1000.0` | `1000.0` | `$1,000.00` | yes | Tier 1 halt. `_dailyPnL <= -DailyLossLimit` sets `_tradingHalted = true` permanently for the session. Also the ceiling in `RiskEnvelopeValidator` assertion D. |
| **`MaxTradeRisk`** | `double` | — | 2 | `200.0` | `200.0` | `200.0` | **`$250.00`** | yes | Per-position worst-case dollar risk (`DEC-20260818-19`). Compared against `StopTicks × tickValue × contracts`. **The live value is 25% above source, and it has to be — see §5.4.** |
| **`MaxOpenPositions`** | `int` | — | 3 | `3` | **`2`** (:127) | **`3`** | `3` | yes | Tier 1 position cap, checked only when `context.CurrentPosition.Quantity == 0`. The subclass asked for 2; the base overwrote it. Inert in practice: `MaxDailyTrades = 1` binds first. |
`RiskPerTrade` is declared under `Sizing` (§5.6) but is a risk parameter in every practical sense;
the GAP-003 assertion `RiskPerTrade > MaxTradeRisk → throw` couples them.
### 5.4 `GroupName = "Risk Tier"`
| Property | Type | `[Range]` | Order | Source (base) | Source (ORB) | Effective | Live 2026-09-08 | Browsable | What it actually does |
|---|---|---|---:|---|---|---|---|---|---|
| `RiskTier` | `RiskTier` enum | — | 1 | `Normal` | — | `Normal` | `Normal` | yes | **Operator posture only — never changed automatically.** Its single behavioural effect: under `Conservative`, a trailing-drawdown breach writes a persistent halt file that survives restart; under `Normal`/`Aggressive` a breach is in-memory only. Nothing else in the codebase branches on it. |
| `MicroUpgradeThreshold` | `double` | — | 2 | `5000.0` | — | `5000.0` | `$5,000.00` | yes | Informational. When realtime account cash value first crosses it, emits `TIER_UPGRADE_SUGGESTED` once and persists a JSON flag (`micro_upgrade_suggested_.json`) so it does not re-fire across restarts. **Does not change `RiskTier`.** Set `<= 0` to disable. |
`RiskTier` is the most over-promised name in the parameter set. An operator reading
`RiskTier: Normal` in an export will reasonably assume it scales risk. It scales nothing.
### 5.5 `GroupName = "Trailing Drawdown"`
| Property | Type | `[Range]` | Order | Source (base) | Source (ORB) | Effective | Live 2026-09-08 | Browsable | What it actually does |
|---|---|---|---:|---|---|---|---|---|---|
| `EnableTrailingDrawdown` | `bool` | — | 1 | `false` | — | `false` | `False` | yes | Opt-in account-scoped realtime halt monitor (§4.6.4). **Turning this on with `AccountStartingBalance = 0` throws at startup** (assertion A) — this is the GAP-046 fix. |
| `AccountStartingBalance` | `double` | — | 2 | `0.0` | — | `0.0` | `$50,000.00` | yes | Funded-account activation balance. Required `> 0` when the monitor is enabled. **Live is $50,000 while the monitor is off** — harmless, and correctly pre-configured for the day it is switched on. |
| `TrailingDrawdownAmount` | `double` | — | 3 | `2500.0` | — | `2500.0` | `$2,500.00` | yes | The prop firm's actual trail. **Informational only** — the halt uses the buffer below, not this. |
| `TrailingDrawdownHaltBuffer` | `double` | — | 4 | `2000.0` | — | `2000.0` | `$2,000.00` | yes | Halt distance below the active peak (or locked value). Deliberately tighter than the $2,500 trail so the strategy halts before the firm does. |
| `TrailingDrawdownLockOffset` | `double` | — | 5 | `100.0` | — | `100.0` | `$100.00` | yes | Lock-in offset above starting balance. **The source comment names Bulenox explicitly and warns other firms differ.** Verify against the actual firm's rules before any funded deployment. |
### 5.6 `GroupName = "Sizing"`
| Property | Type | `[Range]` | Order | Source (base) | Source (ORB) | Effective | Live 2026-09-08 | Browsable | What it actually does |
|---|---|---|---:|---|---|---|---|---|---|
| **`RiskPerTrade`** | `double` | — | 1 | `100.0` | `100.0` | `100.0` | **`$250.00`** | yes | The numerator of `BasicPositionSizer`'s `FixedDollarRisk`: `contracts = RiskPerTrade / (StopTicks × tickValue)`, floored, then clamped to `[MinContracts, MaxContracts]`. Live equals `MaxTradeRisk` exactly — the GAP-003 assertion passes with **zero headroom**. |
| `MinContracts` | `int` | — | 2 | `1` | `1` | `1` | `1` | yes | Floor on sizing, and the threshold for the `SizeBelowMinContracts` reject. Asserted `>= 1` and `<= MaxContracts` at startup (assertion C). |
| `MaxContracts` | `int` | — | 3 | `3` | `3` | `3` | `3` | yes | Ceiling on sizing. **Effectively unreachable while `EnableDynamicStop` is true** — see §5.19, row `MaxContracts`. |
`SizingMethod` is hard-coded to `SizingMethod.FixedDollarRisk` in `InitializeSdkComponents()`
(`:1780`). There is **no property** to select any other sizing method, and the three alternative
sizers are unreachable (§4.6.2).
### 5.7 `GroupName = "Emergency Controls"`
| Property | Type | `[Range]` | Order | Source (base) | Source (ORB) | Effective | Live 2026-09-08 | Browsable | What it actually does |
|---|---|---|---:|---|---|---|---|---|---|
| `EnableKillSwitch` | `bool` | — | 1 | `false` | — | `false` | `False` | yes | **Flatten and stop.** On the first bar it is seen true, calls `ExitLong("KillSwitch")` and `ExitShort("KillSwitch")`; on that bar and **every bar thereafter** it logs a `KillSwitch` reject and returns. It does not arm a safety — it ends the trading session. |
**Counter-recommendation, and a correction to the software's own advice.** `WriteSessionHeader()`
emits `WARNING: EnableKillSwitch=False for gate account {0}` (`:1709`) on every session. Following
that advice — setting `EnableKillSwitch = True` for a gate run — would produce **zero trades and a
log full of `reason=KillSwitch`**. The warning is inverted. It should fire when the kill switch is
*on*, not off. Keep `EnableKillSwitch = False` for Gate Run #3. Carry the warning itself as a `GAP-`
with severity **MEDIUM**: a guardrail that instructs the operator to break the system is worse than
no guardrail.
### 5.8 `GroupName = "Debug"`
| Property | Type | `[Range]` | Order | Source (base) | Source (ORB) | Effective | Live 2026-09-08 | Browsable | What it actually does |
|---|---|---|---:|---|---|---|---|---|---|
| **`EnableVerboseLogging`** | `bool` | — | 1 | `false` | — | `false` | **`True`** | yes | Gates ~15 `Print()` calls: position size, risk approve/reject, submission detail, ETH-bar skips (every 500th bar), CME-holiday skips, micro-upgrade failures. **All Output-window only. Setting this true adds nothing to any file on disk.** |
An operator debugging from session logs gains nothing from `EnableVerboseLogging`. It is useful only
with the NinjaTrader Output window open and being watched live. This is worth stating because the
live value is `True` and it has been read as "we have verbose logs" more than once.
### 5.9 `GroupName = "Confluence"`
| Property | Type | `[Range]` | Order | Source (base) | Source (ORB) | Effective | Live 2026-09-08 | Browsable | What it actually does |
|---|---|---|---:|---|---|---|---|---|---|
| **`MinTradeGrade`** | `int` | `[Range(0, 6)]` | 1 | `4` | **`5`** (:135) | **`4`** | `4` | yes | Minimum confluence grade. `1=F, 2=D, 3=C, 4=B, 5=A, 6=A+` per the `Display` name and `TradeGrade` (`ConfluenceModels.cs:80`). Passed to the SDK strategy via `Parameters["MinTradeGrade"]`; the check is `(int)score.Grade < (int)minGrade → reject GradeFilter`. |
**The subclass asked for Grade A; the base overwrote it to Grade B, and the strategy has been
trading a B filter throughout.** `[Range(0, 6)]` permits `0`, which disables the filter entirely
(every grade `>= 0`); it also permits `6` (A+ only), which on the evidence of the 2026-09-08
telemetry would have produced no trades at all. Note the strategy's own internal fallback when the
parameter is absent is `5` (`SimpleORBStrategy.cs:660`), not `4` — so a configuration path that
fails to deliver the parameter silently tightens the filter by one grade.
### 5.10 `GroupName = "Diagnostics"`
| Property | Type | `[Range]` | Order | Source (base) | Source (ORB) | Effective | Live 2026-09-08 | Browsable | What it actually does |
|---|---|---|---:|---|---|---|---|---|---|
| `EnableFileLogging` | `bool` | — | 10 | `true` | — | `true` | `True` | yes | **The master switch for all on-disk evidence.** Gates `InitFileLog()`, every `FileLog()` call site's guard, and the whole of `LogRejectRateLimited()`. False ⇒ no `session_*.log`. |
| `LogDirectory` | `string` | — | 11 | `string.Empty` | — | `""` | `C:\Users\billy\Documents\NinjaTrader 8\log\nt8-sdk` | yes | Destination for `session_*.log`, `settings_*.txt`, `provenance_*.json`, `trades_*.jsonl`, the micro-upgrade flag and the trailing-drawdown halt file. Blank ⇒ `%USERPROFILE%\Documents\NinjaTrader 8\log\nt8-sdk`. The description's claim of `C:\NT8Logs\Provenance` is **stale and wrong** — `GetDefaultLogDirectory()` (`:1466`) says otherwise. |
| `EnableChartDiagnostics` | `bool` | — | 12 | `false` | — | `false` | **—** (not exported) | yes | Draws per-decision overlays on the chart. **No live value is recorded anywhere.** |
| `EnableStateTelemetry` | `bool` | — | 13 | `true` | — | `true` | `True` | yes | Gates `STATE:` / `STATE_DETAIL:` / `STATE_CONTEXT:`. Throttled to one emission per 30 s (`STATE_TELEMETRY_INTERVAL_SECONDS = 30`, `:148`) **or** on a change in pending-breakout direction or in whether the grade crosses `MinTradeGrade`. |
| **`EnableEthTelemetry`** | `bool` | — | 14 | `false` | — | `false` | **`True`** | yes | Emits `STATE:` telemetry outside RTH without running signal generation. **Read §4.12.3 before using any ETH `STATE:` line** — those lines report `Trend=0.00` and omit all AVWAP fields by construction. |
`EnableChartDiagnostics` is the clearest example of the export's blind spot: it is a
`[NinjaScriptProperty]`, it is in the `ConfigHash`, and there is no artifact from which its live
value can be recovered.
### 5.11 `GroupName = "Trade Direction"`
| Property | Type | `[Range]` | Order | Source (base) | Source (ORB) | Effective | Live 2026-09-08 | Browsable | What it actually does |
|---|---|---|---:|---|---|---|---|---|---|
| `EnableLongTrades` | `bool` | — | 1 | `true` | `true` | `true` | `True` | yes | Checked in `ProcessStrategyIntent` **after** the `SIGNAL:` line, so a suppressed long still appears in the log as a signal, then as `LongTradesDisabled`. |
| `EnableShortTrades` | `bool` | — | 2 | `true` | `true` | `true` | `True` | yes | As above, `ShortTradesDisabled`. The subclass comment records the decision explicitly: *"Shorts are in scope for the gate run."* |
These are the only two direction controls that behave exactly as their names suggest, and they are
usefully placed — after the signal is logged, so turning a direction off still produces evidence
that the setup occurred.
### 5.12 `GroupName = "Exit Management"` (17 base properties + 5 shadowed duplicates)
| Property | Type | `[Range]` | Order | Source (base) | Source (ORB) | Effective | Live 2026-09-08 | Browsable | What it actually does |
|---|---|---|---:|---|---|---|---|---|---|
| `EnableAutoBreakeven` | `bool` | — | 1 | `true` | `true` | `true` | `True` (inside `AutoBreakeven` line) | **`[Browsable(false)]`** | **Inert.** GAP-054 removed the breakeven block that read it; nothing branches on it. Retained for saved-workspace compatibility. |
| `BreakevenTriggerTicks` | `int` | `[Range(1, 100)]` | 2 | `20` | `20` | `20` | `20` (inside `AutoBreakeven` line) | **`[Browsable(false)]`** | **Inert.** GAP-056. Still printed in the export, which is why the deploy script asks the operator to verify it. |
| `BreakevenOffsetTicks` | `int` | `[Range(0, 20)]` | 3 | `1` | `1` | `1` | `1` (inside `AutoBreakeven` line) | **`[Browsable(false)]`** | **Inert.** GAP-056. |
| `EnableRunner` | `bool` | — | 4 | `true` | `true` | `true` | `True` (inside `Runner` line) | yes | **Does not control the runner.** Used only for the chart label (`:2534`) and the export line. The runner is controlled by `RunnerActivationMode`. §4.8.1. |
| **`RunnerTrailTicks`** | `int` | `[Range(4, 50)]` | 5 | `12` | **`20`** (:143) | **`12`** | `12` | yes | Fixed trail distance passed to `SetTrailStop` for the runner leg when `EnableATRTrailing` is false. **The subclass asked for 20; the base overwrote it to 12. `deploy-to-nt8.bat` tells the operator to verify `RunnerTrailTicks=20`, which is unsatisfiable.** |
| `RunnerActivationMode` | `RunnerMode` | — | 6 | `Auto` | — | `Auto` | `Auto` | yes | §4.8.1. `Auto` ⇒ qty≥2 dual-leg, qty=1 runner-only. **Do not set `Mode1DualLeg` explicitly** — quantity-doubling defect at qty=1. |
| `EnableDynamicStop` | `bool` | — | 7 | `false` | — | `false` | **`True`** | yes | When true, `ResolveDynamicStopTicks` replaces `intent.StopTicks` with `round(ATR/TickSize × AtrMultiplier)` clamped to `[MinStopTicks, MaxStopTicks]`. **`StopTicks` becomes dead.** §4.9. |
| `AtrPeriod` | `int` | `[Range(2, 50)]` | 8 | `14` | — | `14` | **—** (not exported) | yes | Period for the dynamic-stop ATR. Also acts as a warm-up gate — `CurrentBars[0] < AtrPeriod` disables the dynamic stop and the configured `StopTicks` is used instead, silently. |
| `AtrMultiplier` | `double` | `[Range(0.1, 5.0)]` | 9 | `1.5` | — | `1.5` | `1.50` | yes | Multiplier on ATR for the stop. |
| `MinStopTicks` | `int` | `[Range(1, 100)]` | 10 | `12` | — | `12` | **—** (not exported) | yes | Lower clamp on the dynamic stop. **Greater than the configured `StopTicks = 8`**, so the effective stop is never the configured one. |
| `MaxStopTicks` | `int` | `[Range(1, 200)]` | 11 | `50` | — | `50` | **—** (not exported) | yes | Upper clamp. **Bound by `RiskEnvelopeValidator` assertion B: `MaxStopTicks × tickValue <= MaxTradeRisk`.** On NQ, `50 × $5.00 = $250.00`. §5.18. |
| `EnableBarBasedRearm` (base) | `bool` | — | 12 | `false` | — | `false` | `False` *(base copy)* | yes | Legacy bar-driven `_tradeTaken` re-arm. **Shadowed** — the copy the SDK strategy receives is the ORB one (§5.13). |
| `EnableATRTrailing` (base) | `bool` | — | 15 | `false` | — | `false` | `False` *(base copy)* | yes | **This is the copy `SubmitOrderToNT8` actually reads** (`:2321`). Shadowed. |
| `ATRTrailingPeriod` (base) | `int` | `[Range(2, 50)]` | 16 | `14` | — | `14` | **—** (not exported) | yes | Read by `SubmitOrderToNT8` (`:2321, :2323`). Shadowed. |
| `ATRTrailingMultiplier` (base) | `double` | `[Range(0.1, 5.0)]` | 17 | `2.0` | — | `2.0` | `2.00` *(base copy)* | yes | Read by `SubmitOrderToNT8` (`:2324`). Shadowed. |
| `ATRTrailingMinTicks` (base) | `int` | `[Range(1, 100)]` | 18 | `8` | — | `8` | **—** (not exported) | yes | Read by `SubmitOrderToNT8` (`:2325`). Shadowed. |
| `ATRTrailingMaxTicks` (base) | `int` | `[Range(1, 200)]` | 19 | `60` | — | `60` | **—** (not exported) | yes | Read by `SubmitOrderToNT8` (`:2325`). Shadowed. |
**Order collisions inside this group.** Base `EnableATRTrailing` is Order 15 and base
`ATRTrailingPeriod` is Order 16, while the ORB subclass's `EnableATRTrailing` is **also** Order 16,
`ATRTrailingPeriod` 17, `ATRTrailingMultiplier` 18, `ATRTrailingMinTicks` 19, `ATRTrailingMaxTicks`
20. Five collisions (16, 17, 18, 19), with identical display names and identical descriptions on
both sides. **An operator cannot tell the two rows apart in the property grid**, and NinjaTrader's
ordering under duplicate `Order` values within a group is unspecified. §4.10.2.
### 5.13 `GroupName = "Trade Management"` (2 base + 3 ORB)
| Property | Declared in | Type | `[Range]` | Order | Source default | Effective | Live 2026-09-08 | What it actually does |
|---|---|---|---|---:|---|---|---|---|
| `EnableShortTrendFilter` | base `:331` | `bool` | — | 13 | `true` | `true` | `True` *(base copy)* | Fed to the SDK strategy through `context.CustomData["EnableShortTrendFilter"]` (`:1946`). |
| `EnableCMEHolidayGuard` | base `:335` | `bool` | — | 14 | `true` | `true` | `True` *(base copy)* | **This copy drives `OnBarUpdate` guard #4** (`:667`). |
| `EnableBarBasedRearm` | **ORB** `:63` | `bool` | — | 13 | `false` | `false` | not exported (derived copy) | Passed to the SDK strategy via `Parameters["EnableBarBasedRearm"]`. Display text `(SIM Only)` vs the base's `(SIM only)` — **the only one of the eight an operator can distinguish in the grid**, and only by the capital O. |
| `EnableShortTrendFilter` | **ORB** `:68` | `bool` | — | 14 | `true` | `true` | not exported (derived copy) | Passed via `Parameters["EnableShortTrendFilter"]`. **`SimpleORBStrategy` reads this one** (repo `:626`), not the base copy the context carries. |
| `EnableCMEHolidayGuard` | **ORB** `:73` | `bool` | — | 15 | `true` | `true` | not exported (derived copy) | Passed via `Parameters["EnableCMEHolidayGuard"]`; drives the strategy-side holiday guard at repo `:401`. |
`EnableShortTrendFilter` is the clearest instance of the hazard: **two copies, two channels, two
consumers.** The base copy travels in `StrategyContext.CustomData`; the derived copy travels in
`StrategyConfig.Parameters`. Today both are `true`. The day an operator sets one of them false, half
the system will honour it.
### 5.14 `GroupName = "Regime Gate"`
| Property | Type | `[Range]` | Order | Source (base) | Source (ORB) | Effective | Live 2026-09-08 | Browsable | What it actually does |
|---|---|---|---:|---|---|---|---|---|---|
| `RegimeGate` | `RegimeGateMode` | — | 1 | `GradePenalty` | — | `GradePenalty` | **—** (not exported) | yes | `Disabled = 0` (legacy), `GradePenalty = 1` (downgrade grade by 1 when the daily trend opposes the trade), `HardVeto = 2` (block). Its only effect is to gate the daily SMA computation in `BuildStrategyContext` (`:1949`) and to publish `CustomData["regime_gate_mode"]` (`:1978`). |
| `SmaPeriodShort` | `int` | `[Range(5, 100)]` | 2 | `20` | — | `20` | **—** (not exported) | yes | Short daily SMA for trend regime. |
| `SmaPeriodLong` | `int` | `[Range(10, 200)]` | 3 | `50` | — | `50` | **—** (not exported) | yes | Long daily SMA. **Also a warm-up gate**: the whole regime block is skipped unless `CurrentBars[1] >= SmaPeriodLong`, i.e. 50 daily bars. The live daily series carried 133, so it was satisfied. |
**None of the three appear in the settings export.** A regime-gate mode change is undetectable from
any artifact — it changes the `ConfigHash` (all three are `[NinjaScriptProperty]`) but the hash is
opaque. If `RegimeGate` is ever changed, note it in `decisions.md` at the time, because the log will
not.
### 5.15 `GroupName = "ORB Strategy"` (`SimpleORBNT8`)
| Property | Type | `[Range]` | Order | Source (ORB) | Effective | Live 2026-09-08 | Browsable | What it actually does |
|---|---|---|---:|---|---|---|---|---|
| `OpeningRangeMinutes` | `int` | `[Range(5, 120)]` | 1 | `30` | `30` | `30` | yes | Constructor argument to `SdkSimpleORB` (`:202`). Defines the ORB window 09:30–10:00 and, via `TryGetRejectSummarySnapshotSuppressionWindow` (`:322`), the window in which `REJECT SUMMARY:` snapshots are suppressed. |
| `StdDevMultiplier` | `double` | `[Range(0.5, 3.0)]` | 2 | `1.0` | `1.0` | `1.00` | yes | `volatilityBuffer = range × (StdDevMultiplier − 1)`, floored at 0. **At `1.00` the buffer is exactly zero**, so the breakout triggers are the raw ORB high and low. Any value ≤ 1.0 is identical in effect. |
| `ForceSessionReset` | `bool` | — | 10 | `false` | `false` | **`False` — unconditionally** | yes | When true, pushes `force_session_reset` into the SDK strategy at `State.Realtime` so `_tradeTaken` is cleared before the first live bar. **The export line is a lie:** it reads `_strategyConfig.Parameters["ForceSessionReset"]` (`:2455`), and **nothing ever writes that key** (verified — `ConfigureStrategyParameters` `:400–445` does not set it). The export prints `False` whatever the property is. The feature itself works, via the `GetForceSessionReset()` override (`:195`). |
| `TestMode` | `bool` | — | 11 | `false` | `false` | `False` | yes | Bypasses the RTH guard, the ORB window and `_tradeTaken`. Surfaces in `SIGNAL:` lines as `TEST MODE ACTIVE`. **Must be `False` for any gate run** — results produced with it true are not gate evidence. |
| `MaxDailyTrades` | `int` | `[Range(1, 10)]` | 12 | `1` | `1` | `1` | yes | Checked twice in `OnBar` (pre- and post-rollover). Persisted per account/date to JSON so a restart does not reset it (GAP-055). |
### 5.16 `GroupName = "ORB Risk"` (`SimpleORBNT8`)
| Property | Type | `[Range]` | Order | Source (ORB) | Effective | Live 2026-09-08 | Browsable | What it actually does |
|---|---|---|---:|---|---|---|---|---|
| **`StopTicks`** | `int` | `[Range(1, 50)]` | 1 | `8` | `8` | `8` — **and unused** | yes | The intent's initial stop. **Overwritten by `ResolveDynamicStopTicks` on every intent while `EnableDynamicStop` is true**, and the dynamic stop's floor is `MinStopTicks = 12`. Its only surviving effects are the export's `StopDollars`/`RR_Ratio` arithmetic (both wrong, §4.9) and the `MaxTradeRisk` widening in `ConfigureStrategyParameters` (§5.18). |
| `TargetTicks` | `int` | `[Range(1, 100)]` | 2 | `16` | `16` | `16` | yes | Fixed profit target for the scaler leg. **Not** ATR-scaled — the target stays 16 ticks while the stop floats between 12 and 50. |
The pairing of a floating stop with a fixed target is the single largest unexamined design decision
in the parameter set. §5.18 and §5.19 both return to it.
### 5.17 NT8 platform properties the SDK sets
All set in `NT8StrategyBase.OnStateChange()`'s `SetDefaults` block (`:464–481`) unless noted. These
are not `[NinjaScriptProperty]` — they are NinjaScript `StrategyBase` members — but they are part of
the configuration contract and three of them have caused observable behaviour.
| Property | Value set | Line | Why, and what it costs |
|---|---|---:|---|
| `Calculate` | `Calculate.OnBarClose` | 464 (base), 133 (ORB) | Every decision is made on bar close. Consequence: the runner trail is the only intrabar mechanism in the system; nothing else can react within a bar. Live: `OnBarClose`, 5-minute bars. |
| `EntriesPerDirection` | `2` | 465 | Required for the dual-leg runner architecture (scaler + runner are two separate entries in the same direction). Also what allows the `Mode1DualLeg` quantity-doubling defect (§4.8.1) to be accepted by NT8 rather than rejected. |
| `EntryHandling` | `EntryHandling.AllEntries` | 466 | Counts all entries toward `EntriesPerDirection`, not just uniquely-named ones. Correct for the two-leg design. |
| `IsExitOnSessionCloseStrategy` | `true` | 467 | NT8 flattens at session close. This is the backstop that guarantees no overnight position regardless of SDK state. |
| `ExitOnSessionCloseSeconds` | `30` | 468 | Flatten 30 s before close. |
| `IsFillLimitOnTouch` | `false` | 469 | Conservative limit-fill simulation. |
| `MaximumBarsLookBack` | `TwoHundredFiftySix` | 470 | Caps series memory at 256 bars. **Any calculator needing more than 256 bars of primary-series history will silently get garbage.** `SmaPeriodLong = 50` is on the *daily* series and unaffected; `AtrPeriod = 14` is fine. Flagged as a constraint on future factors. |
| `OrderFillResolution` | `Standard` | 471 | Backtest fill granularity. |
| `Slippage` | `0` | 472 | **Zero modelled slippage.** Every backtest and Strategy Analyzer result from this strategy is optimistic by 1–2 ticks per side on NQ. Gate evidence must come from SIM fills, not from backtests. |
| **`StartBehavior`** | `AdoptAccountPosition` | 474 (base), 155 (ORB — the only platform property the subclass also sets, to the same value) | See below. |
| `TimeInForce` | `Gtc` | 476 | |
| `TraceOrders` | `false` | 477 | **NT8's own order-lifecycle tracing is off.** Turning it on is the cheapest available diagnostic for the GAP-054 question of which protective exit NT8 actually registered (§4.9). |
| `RealtimeErrorHandling` | `StopCancelClose` | 478 | On a realtime order error, NT8 stops the strategy, cancels orders and closes positions. Safe, and loud. |
| `StopTargetHandling` | `PerEntryExecution` | 479 | Stops and targets are scoped per entry execution — **this is what makes signal-name-scoped `SetStopLoss`/`SetTrailStop` work per leg**, and is a hard requirement of the dual-leg design. |
| `BarsRequiredToTrade` | **`1`** | 481 | The subclass sets 50 at `:134`; the base overwrites it to 1. §4.10.1. Live export confirms `1`. |
| `AddDataSeries(BarsPeriodType.Day, 1)` | — | 544, `State.Configure` | Adds the daily series at `BarsArray[1]` for SMA20/50 regime detection and for the NR7 / ORB-vs-ATR / gap / prior-close factors. Loaded 133 bars on 2026-09-08. `SimpleORBNT8` deliberately does **not** add its own — its `State.Configure` branch is an empty comment saying so (`:158–161`). |
**Why `StartBehavior = AdoptAccountPosition`, and what it costs.** The source comment is explicit:
*"AdoptAccountPosition avoids NT8 start-up synchronization submitting or flattening during
historical replay bursts before the first live bar."* The alternatives (`ImmediatelySubmit`,
`WaitUntilFlat`) would have NT8 reconcile the strategy's computed historical position against the
real account at enable time — which, given that the strategy processes six months of replayed bars
before the first live bar, could submit real orders derived from historical signals.
`AdoptAccountPosition` tells NT8 to accept the account's actual position as the starting state and
submit nothing.
The cost is the historical replay burst, and it is paid three ways:
1. **`ProcessStrategyIntent` guard #1 fires for every intent generated during replay** —
`HistoricalReplayCatchup`, 81 times on 2026-09-08. Correct behaviour, correctly logged.
2. **The log-noise amplification of §4.12.4** — 11,696 lines in one second. A side effect of the
burst, not of `StartBehavior` itself, but it only manifests during the burst.
3. **The `_realtimeBarSeen` latch consumes one live bar.** `OnBarUpdate` guard #9 burns the first
genuine realtime bar as an eligibility marker and generates no signal on it. If the strategy is
enabled at 09:28, the 09:30 bar — the first ORB bar — produces nothing.
`AdoptAccountPosition` is the right choice and should not be revisited. The burst's cost is real but
it is entirely a telemetry and startup-timing cost, not a trading cost. Record as a `D-` deviation
with *Risk accepted: one live bar is consumed at enable time; enable the strategy at least two bars
before the ORB window opens.*
---
### 5.18 The parameter interaction map — where the collisions are
Pairs that are individually valid and jointly impossible, or jointly surprising. "Guarded" means a startup assertion in `RiskEnvelopeValidator` (`BasicRiskManager.cs:327`) fails fast on the combination.
| # | Interaction | Failure it produces | Guarded? |
|---|---|---|---|
| 1 | `MaxStopTicks × tickValue` > `MaxTradeRisk` | The top of the ATR stop range is unreachable; valid signals rejected with `MaxTradeRisk`. Cost 5 signals on 2026-08-18 | ✅ since GAP-045 |
| 2 | `EnableTrailingDrawdown=True` with `AccountStartingBalance=0` | Every entry blocked from the first bar. Cost 27 rejections on 2026-08-18 | ✅ since GAP-046 |
| 3 | `MinContracts` > `MaxContracts` | Sizing can never satisfy both | ✅ |
| 4 | `MaxTradeRisk` > `DailyLossLimit` | One trade can consume the whole daily limit | ✅ |
| 5 | **Subclass default vs base default (`base.OnStateChange()` last)** | Four parameters silently take the base value. Finding 3 | ❌ **GAP-066** |
| 6 | **Base vs shadowed derived property (no `new`)** | Operator sets one value, base code reads another. Finding 4 | ❌ **GAP-067** |
| 7 | `BreakevenTriggerTicks` (20) vs the ATR stop (39 live) vs `TargetTicks` (16) | Breakeven would fire after the scaler target — moot today only because the breakeven block is inert (GAP-056) | n/a |
| 8 | `MinTradeGrade` vs achievable Grade | With the live (pre-GAP-062) scoring, shorts cap at `Trend=0.30` and Grade A is close to structurally unreachable on the short side | ❌ |
| 9 | `DaysToLoad` vs the replay burst | `DaysToLoad=5` loaded 36,303 bars back to 2026-03-06; 11,709 blocked replay intents in one second | ❌ GAP-044 |
| 10 | `RunnerActivationMode=Mode1DualLeg` with sized qty=1 | Two contracts submitted for a one-contract signal | ❌ **GAP-071** |
| 11 | `EnableRunner` vs `RunnerActivationMode` | `EnableRunner` is inert; only the mode controls the runner | ❌ **GAP-072** |
| 12 | `Calculate=OnBarClose` with a 5-minute primary series | Every decision waits for a 5-minute close; the trail is the only intrabar mechanism | n/a — by design |
| 13 | `MaximumBarsLookBack=TwoHundredFiftySix` vs any future long-lookback factor | Silent garbage beyond 256 primary bars | ❌ |
| 14 | `Slippage=0` vs any backtest-derived expectancy | Results optimistic by 1–2 ticks per side | ❌ **GAP-074** |
### 5.19 Recommended configuration for the next gate attempt
Opinionated, with justification. Only rows marked **CHANGE** differ from the 2026-09-08 live export.
| Parameter | Recommended | Live | Justification |
|---|---|---|---|
| `EnableKillSwitch` | **True** | False | **CHANGE.** GAP-033's warning has fired on every session for weeks. A gate account without a kill switch is not a gate account |
| `TraceOrders` | **True** | False | **CHANGE.** NT8's own order-lifecycle trace is the cheapest remaining diagnostic for GAP-054 |
| `RunnerTrailTicks` | **20** | 12 | **CHANGE.** Restore the subclass's stated intent. The 12 was never a decision — it was Finding 3. Make it a decision |
| `MinTradeGrade` | **4 (B)** | 4 | Keep. The gate plan says A, but §8.2 — trade frequency — is the binding schedule risk, and B was what actually ran. Revisit after GAP-062 is genuinely live, since A becomes reachable on the short side for the first time |
| `MaxOpenPositions` | **2** | 3 | **CHANGE.** The subclass asked for 2; with `MaxDailyTrades=1` and a two-leg trade, 3 is meaningless headroom |
| `BarsRequiredToTrade` | **50** | 1 | **CHANGE.** Restore the subclass's warm-up guard |
| `MaxTradeRisk` | $250 | $250 | Correct. Resolves the long-open register question |
| `DailyLossLimit` | $1,000 | $1,000 | Keep |
| `RiskPerTrade` | $250 | $250 | Keep |
| `MinContracts` / `MaxContracts` | 1 / 3 | 1 / 3 | Keep |
| `RunnerActivationMode` | `Auto` | `Auto` | Keep — and do **not** set `Mode1DualLeg` explicitly until GAP-071 is fixed |
| `EnableDynamicStop` / `AtrMultiplier` | True / 1.50 | True / 1.50 | Keep. Produces the ~39-tick stop |
| `MaxDailyTrades` | 1 | 1 | Keep for the gate. Raising it is the obvious lever for §8.2 but must not be pulled mid-gate |
| `EnableTrailingDrawdown` | False | False | Keep off for SIM; it is a funded-account control |
| `EnableEthTelemetry` | True | True | Keep — it is how ETH `STATE:` coverage exists |
| `OpeningRangeMinutes` | 30 | 30 | Keep. A 15-vs-30 comparison is a post-gate optimisation, not a gate change |
| `BarsPeriod` | 5 Minute | 5 Minute | Keep, and record it in the freeze — it was absent from `ConfigHash` until `DEC-20260810-01` |
---
---
## 6. CURRENT STATE — EVIDENCE-BASED, AS OF 2026-09-22
### 6.1 Build, test and code state
| Item | Value | Source |
|---|---|---|
| Solution | `NT8-SDK.sln`, 7 projects, all `net48` | `.sln` + each `.csproj` |
| `NT8.Core` | 74 files, 22,209 lines | file count this session |
| `NT8.Adapters` | 15 files, 5,560 lines | " |
| `NT8.Strategies` | 1 file, 1,531 lines | " |
| `NT8.Contracts` | **0 `.cs` files**, still in the solution | GAP-075 |
| Tests | **562 `[TestMethod]`** — 472 Core / 80 Integration / 10 Performance | grep, MSTest 2.2.10 |
| Source-text tests | **29 of 562 (5.2%)**, 9 files, all in `tests/NT8.Core.Tests/Adapters/` | §15.3 |
| Last recorded run | 580 passing, 2026-09-08 | `[DataRow]` expansion accounts for 580 vs 562; not a contradiction |
### 6.2 Git and working-tree state
```
branch cleanup/wrappers-pass2
HEAD 186e1dd56da7609957207cd1dab2968e0ed7e94d "[GAP-022-FOLLOWUP]: connection-state seam complete"
Wed Aug 26 01:18:21 2026 -0400
remote origin → https://mo@git.thehussains.org/mo/nt8-sdk.git
0 behind, 44 AHEAD — nothing has ever been pushed
```
Modified (4): `src/NT8.Adapters/Strategies/NT8StrategyBase.cs` (+1 line — the GAP-064 `FileLog` fix); `tests/.../OrbConfluenceFactorTests.cs`; `tests/.../SimpleORBHydrationTests.cs`; `tests/.../SimpleORBRejectionLoggingTests.cs`.
Untracked (5): four `TASK_GAP0*.md` prompts and `tests/NT8.Core.Tests/Adapters/NT8StrategyBaseOnBarUpdateVisibilityTests.cs`.
**This is byte-identical to the 2026-09-08 state.** Nothing has been committed, changed or picked up in fourteen days. The working-tree clean/dirty contradiction that the 2026-09-06 and 2026-09-13 reviews could not resolve is hereby resolved: the tree is **dirty**, and `SPRINT_BOARD.md`'s gate table claiming otherwise is wrong.
### 6.3 Deployment state — and the divergence
This subsection is the reason v9.0 exists.
| File in `bin\Custom\Strategies` | Deployed | Repo | Verdict |
|---|---|---|---|
| `NT8StrategyBase.cs` | 2026-08-26, 133,611 B | working tree | **Differs by exactly one line** — the uncommitted GAP-064 `FileLog` at repo `:855`. Deployed copy = HEAD. Correct. |
| `SimpleORBNT8.cs` | 2026-08-25, 31,213 B | — | **Byte-identical.** Correct. |
| `SimpleORBStrategy.cs` | **2026-07-13, 1,189 lines, 51,465 B** | **1,531 lines, 67,242 B** | ❌ **ORPHAN — six weeks stale, never touched by any deploy** |
| `BaseNT8StrategyWrapper.cs`, `SimpleORBNT8Wrapper.cs`, `MinimalTestStrategy.cs` | — | — | Identical to repo |
`NinjaTrader.Custom.dll`: 2026-08-26 10:29, 1,509,888 B.
Also present in the compile directory and worth a sweep: `@@SimpleORBNT8Wrapper.cs` (a duplicate of `SimpleORBNT8Wrapper.cs`, same 9,838 bytes), twelve `@@`/`@`-prefixed unrelated strategies, four `SDK*.zip` archives and a `.DS_Store`. NinjaTrader compiles `.cs` files in this directory; archives and dotfiles are inert but the duplicate wrapper is not obviously so.
**Deployment pipeline state.** 103 backup folders, newest `20260826_011650`. `deployment/{dev,prod,staging}/` are all empty. `manifest.txt` records source and destination paths only — **no hashes, no git SHA, no file sizes** (GAP-068). `Verify-Deployment.ps1:15` expects `MinimalTestStrategy.cs` in the Strategies folder, which `deploy-to-nt8.bat` never copies (GAP-073). `deploy-to-nt8.bat` backs up five files but deploys seven — `NT8StrategyBase.cs` and `SimpleORBNT8.cs` are copied with no rollback copy taken.
### 6.4 Live trading state
**The strategy is stopped.** The most recent session log is `session_20260908_082122.log`, ending `SESSION END 2026-09-08 19:07:39`. No session log, settings export, provenance file or trade file exists after that date. Fourteen days of no live activity.
The last three sessions, in order:
| Session | Window | Trades | GAP-064 signature present? |
|---|---|---|---|
| `session_20260831_082648.log` | 2026-08-31 08:26 → 2026-09-03 14:31 ET (3 days, continuous) | 1 (2026-09-01, the GAP-054 failure) | yes |
| `session_20260903_143151.log` | 2026-09-03 14:31 → 2026-09-07 20:36 ET (5 days) | 0 | yes — 75 `STATE:` / 0 rejects across 2026-09-04 RTH |
| `session_20260908_082122.log` | 2026-09-08 08:21 → 19:07 ET (fresh start) | 0 | **yes — reproduced on a clean session** |
The third row is what killed the "stale long-running session state" hypothesis and forced the search that found the orphan file.
### 6.5 The trading record — everything that has actually filled
Four broker-confirmed trades, 2026-08-07 through 2026-08-17, plus one SIM trade on 2026-09-01. Aggregate is not a sample and no profitability claim rests on it. Appendix E carries the ledger. The 2026-09-01 trade is the GAP-054 evidence and is the only trade in the system's history to reach a large favourable excursion.
### 6.6 Configuration state — live, 2026-09-08
From `settings_Simple_ORB_NT8_20260908_082122.txt`. `ConfigHash 3c902e60…a641f67`, `CodeVersion 8.1.9.0:7a27cca8…f749` — both unchanged since 2026-08-31.
Account `SimSimple ORB`, instrument `NQ SEP26`, **`BarsPeriod: 5 Minute`**, `Calculate: OnBarClose`.
Values that differ from what source or the gate plan expects:
| Parameter | Live | Expected | Note |
|---|---|---|---|
| `MaxTradeRisk` | **$250.00** | $200 feared | ✅ **Open item since 2026-08-26 resolved** — the live value is correct and was never the blocker the register suspected |
| `RunnerTrailTicks` | 12 | 20 per subclass | Finding 3 |
| `MinTradeGrade` | 4 (B) | 5 (A) per subclass and gate plan | Finding 3 |
| `MaxOpenPositions` | 3 | 2 per subclass | Finding 3 |
| `BarsRequiredToTrade` | 1 | 50 per subclass | Finding 3 |
| `EnableKillSwitch` | **False** | True on a gate account | Long-flagged, still wrong |
| `EnableEthTelemetry` | True | — | Explains `STATE:` lines outside RTH |
| `EnableDynamicStop` | True, `AtrMultiplier 1.50` | — | Produces the observed 39-tick stop, not the `StopTicks: 8` literal |
### 6.7 What the governance documents currently get wrong
| Document | Statement | Correction |
|---|---|---|
| `DEC-20260826-01`, `SPRINT_BOARD.md` | GAP-062 "implemented and deployed 2026-08-26" | The DLL deployed; the type was shadowed at compile time. **Never live.** Finding 2 |
| `SPRINT_BOARD.md` gate table | Working tree clean | **Dirty**, and has been continuously since 2026-09-08 |
| `DEC-20260825-04` | The `Trend=0.30` cap is explained and GAP-062 fixes it | Accurate as a description of the *live* system, and still true today because the fix never ran |
| `DEC-20260904-01` / `DEC-20260908-01` | GAP-064 root cause unidentified; hypotheses (a)/(b)/(c) | **Superseded.** Root cause is the deployed-source divergence, none of (a)/(b)/(c) |
| 2026-08-30 review | Recommend closing GAP-034 as correct Grade-A filtering | **Do not.** Same root cause as GAP-064; reopened |
| `current_status.md` (2026-08-25), `active_work.md` (2026-08-24) | various | Four weeks stale; both predate the GAP-054 validation failure and everything since |
| v7.0 §2.5, v8.0 | "five tools" / "nine tools" in `tools/` | Nine directories, **seven tools** — `market-data/` and `replay/` contain only `.gitkeep` |
| `deploy-to-nt8.bat` closing instruction | "Verify … `RunnerTrailTicks=20`" | Unsatisfiable from source defaults. Effective value is 12. Finding 3 |
### 6.8 Configuration drift against the frozen baseline
`freeze_20260816_170304` (`docs/gate-runs/gate3/baseline.json`) predates GAP-047 Part 2, GAP-048, GAP-049, GAP-055, GAP-059, GAP-060, GAP-061, GAP-062, GAP-025, GAP-030, GAP-022-FOLLOWUP, the failed GAP-054 validation, and all of v9.0's findings. It is five weeks stale and must be discarded rather than amended. `DEC-GATE3-CONFIG` remains `draft`. A fresh freeze is §9.4 **P1-G** and must not be taken until P0 completes — freezing a configuration whose effective values differ from its source values would bake Finding 3 into the gate record.
---
---
## 7. GAP REGISTER — CANONICAL, RECONCILED
Numbering continues the repository sequence. New in v9.0: **GAP-065 through GAP-076**. Historical v6.3/v6.4 audit findings remain outside the `GAP-` namespace as `HIST-41`…`HIST-46`.
### 7.1 BLOCKING — Gate Run #3 cannot start
| ID | Item | Severity | Owner | Detail and evidence |
|---|---|---|---|---|
| **GAP-065** | **Deployed-source divergence — NT8 compiles a 2026-07-13 `SimpleORBStrategy.cs`** | **CRITICAL** | Operator | §1.3 Finding 1. Orphan at `bin\Custom\Strategies\`, 1,189 vs 1,531 lines, zero `RecordSignalRejection`. Root cause of GAP-064 and almost certainly GAP-034 |
| GAP-054 | Runner trailing stop did not protect a +$1,200 excursion | CRITICAL | Kilocode | §1.3 Finding 5. SIM-validated 2026-09-01, failed. Fix is present and deployed; mechanism unexplained. `TASK_GAP054_FOLLOWUP_…md` staged 2026-09-02, never picked up |
| **GAP-066** | `base.OnStateChange()` called last; base overwrites four ORB defaults | **HIGH** | Kilocode | §1.3 Finding 3. `RunnerTrailTicks` 20→12, `MinTradeGrade` 5→4, `MaxOpenPositions` 2→3, `BarsRequiredToTrade` 50→1, all live-confirmed |
| GAP-064 | Evaluation pipeline silent for full RTH days | HIGH | — | **Root cause identified (GAP-065).** Remains open until P0-A verifies rejects reappear |
| GAP-034 | Original silent zero-trade defect | HIGH | — | **Reopened.** Same symptom class; do not close as correct filtering |
| **GAP-069** | 44 commits unpushed; no offsite copy of the project exists | **HIGH** | Operator | §6.2. Not a trading defect; a total-loss risk |
| — | Dirty working tree (process blocker, not numbered) | MEDIUM | Operator | Unchanged 14 days; includes one verified-good uncommitted fix |
| — | Gate 3 freeze five weeks stale, `DEC-GATE3-CONFIG` draft | MEDIUM | Operator | §6.8 |
### 7.2 Open — high severity
| ID | Item | Severity | Status |
|---|---|---|---|
| **GAP-068** | Deploy verification is per-file and incomplete; manifest records no hashes | HIGH | New. `preflight.ps1` check 5 hashes only `NT8StrategyBase.cs`; `Write-DeployedSourceHashes` hashes everything and compares nothing |
| **GAP-071** | Explicit `Mode1DualLeg` with qty=1 submits two contracts at double intended risk | HIGH | New, latent — live mode is `Auto`, which cannot reach it. Not runtime-verified; settling test in §4.8.1 |
| GAP-062 | `trend_confirm` direction-blindness | HIGH | **Never live** (Finding 2). Fix exists in repo; becomes live and testable after P0-A |
| GAP-042 | `PortfolioRiskManager` has no account dimension | HIGH | Pre-existing; blocks multi-account |
| GAP-044 | `DaysToLoad` on primary series far below intent | MEDIUM-HIGH | 5 configured, 36,303 bars loaded, replay reaches 2026-03-06 |
| GAP-013/014/015 | ContractRollHandler, LiquidityMonitor L2, config JSON export | MEDIUM | Sprint 3 backlog, untouched |
### 7.3 Open — medium and low
| ID | Item | Severity | Status |
|---|---|---|---|
| **GAP-067** | Eight properties shadowed base/derived without `new`; CS0108 ignored | MEDIUM | New. Finding 4 |
| **GAP-070** | Weekly governance cadence has no guaranteed path to the artifact it reviews | MEDIUM | New. Four consecutive blind runs |
| **GAP-073** | `Verify-Deployment.ps1` and `deploy-to-nt8.bat` disagree on the deployment contract | MEDIUM | New |
| **GAP-074** | `Slippage = 0`; no commission or slippage model in expectancy math | MEDIUM | New. Every backtest optimistic by 1–2 ticks/side |
| **GAP-076** | Unknown whether Strategy Analyzer binds the orphan or the DLL | MEDIUM | New, **unverified**. Until settled, all Strategy Analyzer output from the divergence window is provisional |
| **GAP-072** | `EnableRunner` is inert; `ResolveRunnerMode` never reads it; export line misleading | LOW | New |
| **GAP-075** | `src/NT8.Contracts/` empty project in the solution | LOW | New |
| GAP-040 | Startup WARNING for non-time-based primary series / low `DaysToLoad` | LOW | Never scheduled |
| GAP-022 | `NEWS_DAY_REDUCED_SIZE` scenario | LOW | Deferred — needs calendar + sizing-policy API that does not exist |
| GAP-007 | Walk-forward validation | — | Queued behind a passing gate ruling |
### 7.4 Closed since v8.0
Nothing. No commit has landed since 2026-08-26.
### 7.5 Closed in the v7.0 → v8.0 window (carried forward for the record)
GAP-025, GAP-030, GAP-045, GAP-046, GAP-047 (Parts 1 and 2), GAP-048, GAP-049, GAP-050, GAP-051, GAP-052, GAP-053, GAP-055, GAP-056, GAP-057, GAP-058, GAP-059, GAP-060, GAP-061, GAP-063, GAP-022-FOLLOWUP — twenty-one items, all diff-verified at the time. **Caveat added in v9.0:** any of these whose implementation lives in `SimpleORBStrategy.cs` was closed in the repository but has not been executing. GAP-062 is the confirmed case; GAP-030 and GAP-055 also touch that file and their live status should be re-confirmed after P0-A.
### 7.6 Register hygiene rule, restated
`GAP-nnn` numbers mean whatever `docs/00-governance/roadmap.md` says they mean; the repo register outranks this document. New gaps are numbered from the highest existing number upward. The `HIST-` prefix exists so that the v6.3/v6.4 audit findings can never again collide with repository gap numbers.
---
---
## 8. GAPS IN THE ROADMAP ITSELF
v7.0 identified eleven. Most remain. Three are now sharper and one is new.
**8.1 There is still no acceptance criterion for "the strategy is profitable."** Gate Run #3 has entry and running rules but the outcome matrix has never been agreed in numbers — how many trades, what expectancy, what maximum drawdown, and what happens on each outcome. Without it, the gate can only ever produce an argument.
**8.2 Nothing on the roadmap increases trade frequency.** Four confirmed trades in the system's life. With `MaxDailyTrades=1` and a grade filter, the gate's 20-trade minimum is a multi-month exercise. This is the single largest schedule risk and no item addresses it.
**8.3 Configuration discipline is written as a rule, not as a control.** v7.0 said this. v9.0 proves it: the freeze mechanism hashes the deployed source files and never compares them, the deploy script prints an instruction to verify a value that cannot be true, and the effective configuration differs from the source configuration in four places. Rules that are not enforced by a failing check are documentation.
**8.4 The roadmap has no instrument strategy.** The MNQ cutover (`DEC-20260819-01`) was sequenced behind validations that have since failed. It has never been staged as a task and has not been mentioned in any weekly review.
**8.5 There is no plan for the short side.** GAP-062 was the enabling fix and it has never run. Short setups have been structurally capped at `Trend=0.30` for the entire history of the system.
**8.6 The 24×5 plan is a list of names, not a plan.**
**8.7 Dashboard work has outrun the strategy work.** Four DASH items delivered against zero validated trading.
**8.8 No rollback or known-good-configuration concept exists.** There is no artifact that says "this exact set of files, at these exact hashes, was the last configuration that traded correctly." GAP-065 is what that absence costs.
**8.9 The broker-neutral end state has no incremental path.**
**8.10 Test coverage has no target and no gap analysis** — and, as §15.2 shows, the uncovered surface is precisely where every defect has been.
**8.11 (new) The roadmap has no verification step between "deployed" and "validated."** Every prior sequence went implement → deploy → validate. The missing step is *confirm that what is running is what you deployed*. All of v9.0's headline findings live in that gap.
---
---
## 9. ROADMAP v9.0 — RE-SEQUENCED
### 9.1 The thesis
The project's constraint has not been implementation capacity — twenty-one gaps closed in eight days in August proves that. The constraint is that **evidence collected from this system has not been trustworthy**, and until it is, every hour of diagnosis is at risk of describing a program that is not running.
So v9.0 inverts the usual order. Stage 0 is not "unblock the gate." Stage 0 is **make the system observable and its evidence trustworthy**, because everything downstream depends on it and because it is cheap — most of P0 is an afternoon.
### 9.2 Deviations from current doctrine, stated explicitly
| ID | Deviation | Risk accepted |
|---|---|---|
| D-1 | GAP-034 is reopened rather than closed, against two prior recommendations | The register carries an open item that may prove to be a duplicate of GAP-064 |
| D-2 | The existing Gate 3 freeze is discarded outright, not amended | Loses continuity with `DEC-GATE3-CONFIG` draft; accepted because the freeze predates the effective-value finding |
| D-3 | P0 blocks all strategy work, including GAP-054 | Delays the only money-relevant defect by roughly a day; accepted because GAP-054 diagnosis is worthless against an unverified deployment |
| D-4 | `MinTradeGrade` stays at B (4) for the next gate rather than reverting to A (5) | Lower bar than the gate plan assumed; accepted deliberately to address §8.2 — see §5.19 |
| D-5 | Commits are pushed to origin before any further code work | None material; this should never have been a deviation |
### 9.3 STAGE 0 — RESTORE TRUST IN THE ARTIFACT (target: one working day)
Nothing else starts until every P0 item is done and verified.
| ID | Task | Owner | Done when |
|---|---|---|---|
| **P0-A** | Delete the orphan `SimpleORBStrategy.cs` from `bin\Custom\Strategies\`. Sweep the folder for other non-deployed `.cs`, the duplicate `@@SimpleORBNT8Wrapper.cs`, the four `SDK*.zip` and `.DS_Store`. Delete `NinjaTrader.Custom.dll`, restart NT8, recompile, re-add the strategy | Operator | A SIM session shows `REJECT: reason=OrbRangeNotEstablished` at normal cadence on a quiet RTH day |
| **P0-B** | Extend `preflight.ps1` check 5 from one file to the whole Strategies folder: every deployed `.cs` must hash-match a repo path, **and any deployed `.cs` matching no repo path is a failure** | Kilocode | Preflight fails if an orphan is reintroduced |
| **P0-C** | Move `base.OnStateChange()` to run **before** `SimpleORBNT8`'s `SetDefaults` assignments | Kilocode | Live export shows the subclass's intended values, or §5.19's chosen values |
| **P0-D** | `git push origin cleanup/wrappers-pass2` — 44 commits | Operator | `git rev-list --count origin/…..HEAD` returns 0 |
| **P0-E** | Commit the verified-good GAP-064 `FileLog` fix and its regression test (`DEC-20260908-01` recommended this on 2026-09-08) | Kilocode | HEAD advances |
| **P0-F** | Give the weekly scheduled session a guaranteed path to repo state, or change the cadence to require an operator-run state capture | Operator | Next Sunday's review contains a real `git status` |
| **P0-G** | Set `TraceOrders = true` and `EnableKillSwitch = true` on the gate account | Operator | Next session header shows both |
### 9.4 STAGE 1 — MAKE THE INSTRUMENT TRUSTWORTHY (target: 3–5 working days)
| ID | Task | Owner | Depends on |
|---|---|---|---|
| **P1-A** | One clean SIM day with the corrected deployment. Confirm the full reject taxonomy appears, `STATE:` and rejects agree, and the log tells a coherent story end to end | Operator | P0-A |
| **P1-B** | Re-run the GAP-047 weight rescore study against post-P0 telemetry. The original study's `STATE:`-derived population came from the stale strategy | Kilocode | P1-A |
| **P1-C** | GAP-062 SIM before/after grade-distribution observation — meaningful for the first time | Operator | P0-A |
| **P1-D** | Remove the eight shadowed property declarations from `SimpleORBNT8`; treat CS0108 as an error | Kilocode | P0-C |
| **P1-E** | Add the two regression tests from §15.4: deployed-tree drift, and effective-post-init configuration values | Kilocode | P0-B, P0-C |
| **P1-F** | Re-confirm the live status of every closed gap whose implementation lives in `SimpleORBStrategy.cs` — GAP-030, GAP-055, GAP-048's strategy-side taxonomy | Kilocode | P0-A |
| **P1-G** | Fresh Gate 3 configuration freeze against the corrected, verified deployment; supersede `DEC-GATE3-CONFIG` | Operator | all of P1 |
### 9.5 STAGE 2 — RESOLVE THE RUNNER (target: 2–4 days, overlaps Stage 1)
| ID | Task | Owner | Note |
|---|---|---|---|
| **P2-A** | Execute `TASK_GAP054_FOLLOWUP_TRAIL_VALIDATION_FAILURE_PROMPT.md` — staged 2026-09-02, never opened | Kilocode | Now with `TraceOrders=true` available as a new diagnostic |
| **P2-B** | Decide `RunnerTrailTicks` deliberately — 12 or 20 — now that the effective value is known to differ from the intended one | Operator | Blocks P2-C |
| **P2-C** | Re-validate the runner: one SIM trade reaching a large favourable excursion, with `ORDER` lifecycle lines proving the trail ratcheted, not PnL-math inference | Operator | P2-A, P2-B |
| **P2-D** | Fix GAP-071 (`Mode1DualLeg` + qty=1 double submission) before any explicit mode change | Kilocode | Latent today |
| **P2-E** | RUNNER-001 sweep — only after P2-C passes | Operator | Must not run against an unvalidated fix |
### 9.6 STAGE 3 — GATE RUN #3 (target: 2 weeks minimum, realistically longer)
**Entry criteria — all must hold.** P0 complete and verified. P1-A through P1-G complete. P2-C passed. Working tree clean and pushed. Fresh freeze recorded with a `DEC-GATE3-CONFIG` that is `accepted`, not `draft`. `EnableKillSwitch=True`. Deployed tree hash-verified against the repo on the morning of day one.
**Running rules.** No deploy to the gate machine during the run. Daily deployed-tree verification as part of the pre-market checklist (§16.1). Any session that produces zero rejects of any strategy-side reason is treated as a failed session and halts the clock, not as a quiet day.
**Exit criteria and the outcome matrix.** This must be agreed in numbers before the clock starts — §8.1. Minimum viable form: 20 trades or 6 weeks, whichever comes first; record expectancy, win rate, maximum drawdown, and per-grade performance; and pre-commit to what each outcome means (proceed to walk-forward / retune and re-gate / stop).
### 9.7 STAGE 4 — RULING AND WALK-FORWARD (1 week)
GAP-007, against the gate sample, per the `DEC-20260814-03` backtest validity rules (§15.5).
### 9.8 STAGE 5 — LIVE MICRO (30+ sessions)
MNQ, minimum size. The MNQ cutover (`DEC-20260819-01`) is staged here and needs its own task file, which does not yet exist.
### 9.9 STAGE 6 — SCALE, 24×5 AND SECOND STRATEGY
Unchanged from v7.0 §9.9 and still correctly sequenced last. GAP-042 (account dimension in `PortfolioRiskManager`) is the hard prerequisite for multi-account.
### 9.10 Critical path
```
P0-A ─┬─> P1-A ─┬─> P1-B
│ ├─> P1-C
│ └─> P1-F ──> P1-G ──┐
P0-C ─┴─> P1-D ──> P1-E ────────────┤
P0-B ───────────────────────────────┤
P0-D, P0-E, P0-F, P0-G ─────────────┼──> STAGE 3 (Gate Run #3)
P2-A ──> P2-B ──> P2-C ──> P2-E ────┘
```
The binding constraint is P0-A → P1-A → P1-G. Everything else parallelises.
### 9.11 Honest timeline
P0 is one day of operator time. Stage 1 is a week. Stage 2 is unbounded — GAP-054 has resisted two diagnostic passes and may resist a third. Gate Run #3 cannot start in under two weeks and, at one trade per day maximum with a grade filter, will take six to twelve weeks to reach a 20-trade sample. Anyone planning around "live in a month" should revise.
---
---
## 10. NEXT STEPS — THE ORDERED ACTION LIST
### 10.1 This week
| ID | Action | Owner |
|---|---|---|
| **N-01** | Delete the orphan `SimpleORBStrategy.cs` from the NinjaTrader Strategies folder. Sweep the folder. Delete `NinjaTrader.Custom.dll`, restart, recompile, re-add the strategy | Operator |
| **N-02** | Run one SIM day and confirm `REJECT: reason=OrbRangeNotEstablished` appears. This single observation closes GAP-064, GAP-034 and validates the whole diagnosis | Operator |
| **N-03** | `git push origin cleanup/wrappers-pass2`. Forty-four commits exist on one laptop | Operator |
| **N-04** | Commit the GAP-064 `FileLog` fix and its test — recommended on 2026-09-08, still sitting | Kilocode |
| **N-05** | Stage and run the P0-C task: fix the `base.OnStateChange()` ordering | Claude → Kilocode |
| **N-06** | Stage and run the P0-B task: whole-folder deploy verification in `preflight.ps1` | Claude → Kilocode |
| **N-07** | Set `EnableKillSwitch=True` and `TraceOrders=true` on the gate account | Operator |
| **N-08** | Decide the weekly-review access fix (P0-F) | Operator |
### 10.2 Next — the highest-value work in the project
| ID | Action | Owner |
|---|---|---|
| **N-09** | Execute the GAP-054 follow-up diagnostic, now with `TraceOrders` | Kilocode |
| **N-10** | GAP-062 SIM before/after observation | Operator |
| **N-11** | Re-run the GAP-047 rescore against trustworthy telemetry | Kilocode |
| **N-12** | Add the deployed-drift and effective-configuration regression tests | Kilocode |
| **N-13** | Decide `RunnerTrailTicks` and `MinTradeGrade` deliberately (§5.19) | Operator |
| **N-14** | Agree the Gate Run #3 outcome matrix in numbers (§8.1) | Operator |
### 10.3 Then
| ID | Action |
|---|---|
| **N-15** | Fresh Gate 3 freeze and an `accepted` `DEC-GATE3-CONFIG` |
| **N-16** | Re-confirm live status of GAP-030, GAP-055 and GAP-048's strategy-side taxonomy |
| **N-17** | Fix GAP-071 before any explicit runner-mode change |
| **N-18** | Remove the eight shadowed declarations |
| **N-19** | Address §8.2 — trade frequency — as a first-class roadmap item |
| **N-20** | Start Gate Run #3 |
### 10.4 What NOT to do next
| Do not | Why |
|---|---|
| Diagnose GAP-054 before N-01 completes | Any log evidence collected before the deployment is corrected is evidence about the wrong program |
| Close GAP-034 as "correct Grade-A filtering" | Two prior reviews recommended this. It is the same root cause as GAP-064 |
| Amend the existing Gate 3 freeze | It predates the effective-value finding. Discard and retake |
| Start Gate Run #3 to "gather data while we fix things" | A gate run against an unverified deployment produces uninterpretable evidence, which is how Gate Runs #1 and #2 were voided |
| Build more dashboard | §8.7. Four DASH items against zero validated trades |
| Trust any Strategy Analyzer output from the divergence window | GAP-076 is unresolved — it is not known whether the analyzer bound the orphan or the DLL |
| Re-run a weekly governance review without repo access | Four consecutive runs have now produced the same unverifiable output |
---
---
## 11. PARKING LOT
| ID | Item | Trigger to revisit |
|---|---|---|
| PL-01 | 15-minute vs 30-minute opening range comparison | After a passing gate ruling |
| PL-02 | MNQ cutover (`DEC-20260819-01`) | Stage 5 |
| PL-03 | Second strategy (VWAP mean reversion, TASK-06d) | Stage 6 |
| PL-04 | `NEWS_DAY_REDUCED_SIZE` scenario | When a news-calendar and sizing-policy API exists |
| PL-05 | Account dimension in `PortfolioRiskManager` (GAP-042) | Before any multi-account work |
| PL-06 | Control-plane UI (write path to NT8) | After Stage 5 |
| PL-07 | Apprise notification module in the dashboard server | Any time; zero trading risk |
| PL-08 | `ContractRollHandler` completion (GAP-013) | First quarterly roll that matters |
| PL-09 | Level II liquidity (GAP-014) | When execution quality becomes the constraint |
| PL-10 | Config JSON export/import (GAP-015) | When freeze/restore becomes manual toil |
| PL-11 | Multi-timeframe regime alignment | Unscoped |
| PL-12 | Flag Grade as informational when `DirectionSource != PendingBreakout` | Next dashboard pass |
| PL-13 | `.git/index.lock` recurrence | If it blocks a commit |
| PL-14 | Daily-bar count variance (129 → 87 at identical `DaysToLoad`) | If a daily-context factor misbehaves |
| PL-15 | Empty `deployment/{dev,prod,staging}` folders | Housekeeping |
| PL-16 | `src/NT8.Contracts` empty project (GAP-075) | Next solution-level change |
| PL-17 | Optimal-f / Kelly sizing paths (built, unwired) | After 100+ trades exist to fit |
| PL-18 | Walk-forward automation | After GAP-007 runs once manually |
---
---
## 12. OPTIMISATION — PROFIT AND DRAWDOWN
### 12.1 Where the money actually is
The system has four broker-confirmed trades and one instructive SIM trade. On that evidence, the ranked opportunities are not subtle:
1. **The runner.** One trade reached +$1,200 unrealized and returned -$200.76. Whatever GAP-054 is, it is worth more than every other optimisation on this list combined.
2. **Trade frequency.** Four trades in the system's life. Expectancy is unmeasurable at this rate; §8.2.
3. **The short side.** Structurally capped since inception because GAP-062 never ran. Roughly half the opportunity set has been unavailable.
4. **Grade calibration.** Only meaningful once 1–3 are addressed and a real sample exists.
### 12.2 Ranked optimisation backlog
| ID | Optimisation | Expected value | Precondition |
|---|---|---|---|
| O-00 | Fix GAP-054 | Highest in the project | P0 complete |
| O-01 | Make GAP-062 actually live | Unlocks the short side | P0-A |
| O-02 | Raise `MaxDailyTrades` above 1 | Directly attacks §8.2 | Post-gate |
| O-03 | Revisit `MinTradeGrade` once A is reachable on shorts | More qualifying setups | O-01 |
| O-04 | Re-run the GAP-047 weight study on trustworthy telemetry | Corrects a study built on stale data | P1-A |
| O-05 | `RunnerTrailTicks` sweep (RUNNER-001) | Unknown until O-00 | P2-C |
| O-06 | 15 vs 30-minute ORB window | Unknown | Post-gate |
| O-07 | Commission and slippage model in expectancy | Makes every other number honest | GAP-074 |
| O-08 | Session-window expansion toward 24×5 | Large, far out | Stage 6 |
### 12.3 Drawdown control — what actually protects the account
In order of how much they have actually prevented: `IsExitOnSessionCloseStrategy=true` (guarantees no overnight position regardless of SDK state); `MaxDailyTrades=1` (caps daily exposure to one trade); `DailyLossLimit` and the Tier 1 `MaxTradeRisk` check, now quantity-aware since GAP-050; the trailing-drawdown monitor (off in SIM, and the correct control for a funded account); and the kill switch, which is currently **off** and should not be.
### 12.4 Optimisations that look attractive and are not
| Do not | Why |
|---|---|
| Tune confluence weights to increase trade count | The weights were just corrected once (GAP-047) against a population that came from the stale strategy. Re-tuning against four trades is curve-fitting to noise |
| Lower `MinTradeGrade` to F to "get data" | Produces a sample of trades the system would never take. Worse than no data |
| Enable ATR trailing to fix the runner | GAP-067 means the setting may not reach the code that reads it, and GAP-054's mechanism is unknown. Fix the known defect first |
| Add a second strategy to diversify | Zero validated strategies. Diversifying nothing yields nothing |
| Optimise the dashboard's poll interval | §8.7 |
---
---
## 13. RISK AND DRAWDOWN DOCTRINE
Ten rules. Each exists because something went wrong, and each names the evidence that produced it.
Rules 1–6 carry forward from v7.0 §13 unchanged in substance; 7–10 were earned since.
1. **Risk validation is never bypassed.** No strategy-level path submits an order without passing
the full guard sequence. Adding one is a rejected design.
*Originating evidence:* the April–July 2026 `TestMode` run, where a diagnostic flag bypassed the
ORB window, the RTH gate and the `tradeTaken` guard and produced 67 round-trips that measured a
different strategy than the one under test. Gate Run #1, void.
2. **Managed-order sequence is mandatory.** `SetStopLoss` and `SetProfitTarget` are issued before
`EnterLongManaged`/`EnterShortManaged`. Reversing this leaves the position unprotected between
fill and stop placement.
*Originating evidence:* NinjaScript's managed-order contract, codified in this project after
early unprotected-fill incidents; now enforced at `NT8StrategyBase.cs:2298` and `:2318` and
asserted by `NT8StrategyBaseRunnerTrailTests`.
3. **A configuration that can breach its own limits is a defect, not a tuning choice.** Enforce at
startup, fail loudly, name both values.
*Originating evidence:* GAP-003's `RiskPerTrade ≤ MaxTradeRisk` assertion established the
pattern; GAP-045 (`MaxStopTicks × tickValue = $250 > MaxTradeRisk $200` on NQ, five signals
rejected 2026-08-18 10:10 ET) and GAP-046 (`EnableTrailingDrawdown` enabled with
`AccountStartingBalance = 0`, 27 rejections the same afternoon) are both cases where it was not
extended.
4. **Never tune a parameter on a live armed strategy.** Parameter changes belong in a disarmed
window with a backtest behind them.
*Originating evidence:* `DEC-20260810-02`'s reasoning, which stands even though its conclusion
was superseded by `DEC-20260815-01`.
5. **One account, one configuration, one instrument, one bar type, for the duration of a gate run.**
*Originating evidence:* GAP-023 established the doctrine on 2026-07-13. It was violated on
08-11, 08-13 and again on 08-18, when two instances traded `SimSimple ORB` / NQ SEP26
concurrently, both emitted `SIGNAL: Sell NQ` at 10:10:24, and nine distinct `ConfigHash` values
appeared in a single day. This is the rule the project breaks most often and the one that has
cost it the most — it is a principal cause of Gate Run #2's voiding.
6. **The daily loss limit is the last line, not the plan.** If a single trade can consume most of
it, the per-trade controls are not doing their job.
*Originating evidence:* Finding 3 of v7.0 — `MaxTradeRisk` has no quantity term, so worst-case
position risk is `MaxTradeRisk × MaxContracts`. At the live $250 × 3 that is **$750 against a
$1,000 `DailyLossLimit`** — 75% of the day's floor in one trade.
7. **A deploy is not complete until the deployed tree is verified against the repository, file by
file, including files the repository does not know about.** Existence checks are not content
checks, and a diff restricted to expected files cannot find an unexpected one.
*Originating evidence:* the deployed-source divergence (§6.3). A 2026-07-13 copy of
`SimpleORBStrategy.cs` (1,189 lines / 51,465 bytes) has been shadowing the repo's 1,531-line
version since at least 2026-08-26, verified by direct read of
`bin\Custom\Strategies\SimpleORBStrategy.cs` this session. `preflight.ps1` check 5 compares only
`NT8StrategyBase.cs` and was passing throughout. Cost: three months of misdirected GAP-034 and
GAP-064 diagnosis, and GAP-062's fix never being live despite `DEC-20260826-01` recording it as
deployed.
8. **Effective configuration, not source defaults, is the configuration.** A parameter's live value
must be read from `settings_*.txt`, never from `SetDefaults()`.
*Originating evidence:* Finding 2 (§6.4). `SimpleORBNT8.OnStateChange()` calls
`base.OnStateChange()` **last** (`SimpleORBNT8.cs:163`), so the base `SetDefaults` block
overwrites four non-shadowed properties the subclass just set: `RunnerTrailTicks` 20→**12**,
`MinTradeGrade` 5→**4**, `MaxOpenPositions` 2→**3**, `BarsRequiredToTrade` 50→**1**. All four
confirmed against `settings_Simple_ORB_NT8_20260908_082122.txt`. The strategy has been risking a
12-tick runner trail while the subclass asked for 20, and `deploy-to-nt8.bat` instructs the
operator to verify `RunnerTrailTicks=20` — an unsatisfiable check.
9. **A silent failure is a severity upgrade, not a severity discount.** Any guard, logger or
persistence path that can return early without writing evidence must log the early return.
*Originating evidence:* four instances of one class. `LogSignalRejectionFromContext`
(`NT8StrategyBase.cs:1504`) returns immediately unless `context.CustomData` contains
`signal_reject_reason` (`:1509`) — the deployed strategy never writes that key, so **every
strategy-side reject reason has been absent from the log since at least 2026-07-13**.
`WriteSessionProvenance()` and `WriteTradeProvenance()` returned silently on a blank
`LogDirectory`, losing provenance for four broker-confirmed trades (`DEC-20260817-01`). GAP-063
found strategy-init failures invisible. And `OnBarUpdate`'s catch block swallowed exceptions
until the still-uncommitted one-line `FileLog` fix (repo `NT8StrategyBase.cs:855`; **verified
this session as present in the repo and absent from the deployed copy**). In each case the code
was correct in its own terms and the *evidence channel* was the defect.
10. **A guard whose activation cannot be distinguished from its misconfiguration is not a guard.**
Reject reasons must separate "the limit fired" from "the limit is not configured."
*Originating evidence:* `TrailingDrawdownBreach` reported a genuine breach and an unconfigured
`AccountStartingBalance` under one label (GAP-046); `KillSwitch` reported four distinct causes
under one label until GAP-048 split it — demonstrated by 647 genuine kill-switch rejections on
2026-08-17 against 5 Tier-1 risk rejections on 2026-08-18, indistinguishable in
`REJECT SUMMARY`, which aggregates on `reason`.
---
---
## 14. THE STANDALONE PLATFORM — TARGET ARCHITECTURE
### 14.1 What already exists that gets you most of the way
A platform-neutral core with no NinjaTrader references. A documented adapter seam (`INT8Adapter`, `INT8ExecutionBridge`, `INT8OrderAdapter`). A read-only dashboard that consumes only on-disk artifacts. A provenance trail with `ConfigHash` and `CodeVersion`. Structured, parseable log lines (§4.12).
### 14.2 Target architecture
```
Strategy authors ──> IStrategy implementations
│
NT8.Core (risk, sizing, confluence, OMS, execution)
│
┌─────────────┼─────────────┐
NT8 adapter
│
NinjaTrader 8
│
on-disk artifacts ──> dashboard / control plane
```
### 14.3 The control plane — two paths, one recommendation
An NT8 AddOn (in-process, powerful, couples the platform to NinjaTrader) versus an external command channel (a file or socket the strategy polls; loosely coupled, testable, broker-neutral). **Recommend the external command channel**, consistent with the platform-neutral invariant. It is also the only one of the two that can be exercised without NinjaTrader running.
### 14.4 Control-plane safety requirements
Read paths may be added any time. Write paths — pause, flatten, kill — require: an explicit operator confirmation step, an audit line in the session log for every command received and acted on, a fail-closed default if the channel is unavailable, and no capability to *start* trading remotely. Bind to `127.0.0.1` only.
### 14.5 Incremental path
The missing piece in §8.9 is that broker-neutrality has never had a first step. The cheapest real one: implement a second `IStrategy` consumer that is not NinjaTrader — a replay harness that feeds `BarData` from a CSV through the same core and asserts the same intents. It proves the seam, needs no second broker, and doubles as the execution-test surface §15.2 says is missing.
---
---
## 15. TESTING AND VALIDATION
### 15.1 Present state
| Suite | `[TestMethod]` count | Coverage character |
|---|---|---|
| `tests/NT8.Core.Tests` | **472** | Unit tests across Risk, Sizing, OMS, Intelligence, Analytics, Execution, Indicators, Calendar, Logging, Strategies, Adapters |
| `tests/NT8.Integration.Tests` | **80** | Cross-layer wiring, `ConfigHash`, NT8 adapter integration, phase integration suites |
| `tests/NT8.Performance.Tests` | **10** | Latency and throughput |
| **Total** | **562** | MSTest, `net48`, Release |
Counts verified this session by `grep -c "\[TestMethod\]"` per project. A further 5 sit in
`tests/_archive/` and are not in `NT8-SDK.sln`.
**On the "580 passed" figure.** Governance documents and commit trailers quote execution counts —
516, 538, 543, 569, 580 — that rise over time and exceed the static count. This is not a
contradiction and should not be written up as one. MSTest expands each `[DataRow]` attribute into a
separate executed test while `[TestMethod]` is declared once, so the static declaration count (562)
is necessarily lower than the executed count (~580). Both numbers are correct; they measure
different things. Cite 562 when describing the suite's surface area and the execution count only
when quoting a specific run.
The framework is **MSTest**, not xUnit. A contributor writing `[Fact]` writes a test that silently
does not run.
### 15.2 What is not covered — and it is exactly where every defect has been
This is the most important paragraph in this section, so it is stated without hedging.
**The two files that execute in production have no execution coverage at all.**
`NT8StrategyBase.cs` (3,011 lines) and `SimpleORBNT8.cs` (677 lines) derive from
`NinjaTrader.NinjaScript.Strategies.Strategy`. That base class cannot be constructed outside the
NinjaTrader runtime: it requires platform state, data series, an account object and a lifecycle the
test host cannot supply. So no test instantiates either class, no test calls `OnBarUpdate`,
`OnStateChange`, `ProcessStrategyIntent`, `SubmitOrderToNT8`, `MaybeWriteRejectSummarySnapshot` or
`LogSignalRejectionFromContext`, and no test exercises the guard sequence, the runner/scaler split,
the breakeven path, the provenance writers or the telemetry emitters.
What exists instead is **29 source-text assertions across nine files** — 5.2% of the suite — that
read those two `.cs` files off disk and grep them. That is the entire test-facing surface of the
two highest-risk files in the system.
Now line up every significant defect in this project's history against that boundary.
| Defect | Lives in | Covered by an execution test? |
|---|---|---|
| **The deployed-source divergence (§6.3)** | The *file identity* of `SimpleORBStrategy.cs` in NinjaTrader's compile directory | **No.** No test of any kind looks at the deployed tree. `preflight.ps1` check 5 looks at exactly one of the three files |
| **Finding 2 — `base.OnStateChange()` ordering** (§6.4) | `SimpleORBNT8.OnStateChange()`, `:163` | **No.** `SimpleORBNT8DefaultsTests.SetDefaults_DirectionFlags_EnableLongAndShortTrades` is a *source-text* assertion that the subclass assigns the flags. It cannot observe that the base class then overwrites them |
| **Finding 3 — property shadowing** (§6.5) | Eight duplicate property declarations across both files | **No.** And this one is not even detectable by source-text assertion on one file — it requires comparing two files' declaration sets. Compiler warning CS0108 would have caught it and is evidently not treated as an error |
| **GAP-054 — runner trailing stop** | `NT8StrategyBase.OnBarUpdate` breakeven block and `SubmitOrderToNT8` runner arming | **No.** Three source-text tests in `NT8StrategyBaseRunnerTrailTests` assert that no `SetStopLoss` call targets the runner signal name after `SetTrailStop` — a real and useful assertion about *text*, which cannot observe a 240-tick MFE closing at a full stop-out |
| **GAP-060 — `REJECT SUMMARY` blackout** | `MaybeWriteRejectSummarySnapshot`'s date/window state machine | **No.** Four source-text tests in `NT8StrategyBaseRejectSummaryTests`. The defect was a *state machine over trading dates* — a flag firing once per session lifetime instead of once per day. That is a behaviour no grep can see |
| **GAP-063 — init-failure invisibility** | `OnStateChange` / `OnBarUpdate` exception handling | **No.** One source-text test |
| **GAP-064 — silent signal pipeline** | `OnBarUpdate` → `_sdkStrategy.OnBar()` → `ProcessStrategyIntent` | **No.** The single test in `NT8StrategyBaseOnBarUpdateVisibilityTests` — `OnBarUpdate_CatchBlockWritesExceptionToFileLog` — is a source-text assertion, and it is untracked in git as of this session |
**Seven for seven.** Every defect that has cost this project time, money or voided evidence lives in
the uncovered surface, and none lives in the 533 tests that do execute code. The 472 Core tests are
good tests of `NT8.Core` — `BasicRiskManager`, `ConfluenceScorer`, `OrderStateMachine`,
`OptimalFCalculator` and the rest are genuinely well covered — and `NT8.Core` has produced
essentially no production incidents. The correlation is not a coincidence. **This project's test
suite is thorough about the layer that has never broken and blind to the layer that breaks
constantly.**
Two consequences follow. First, **test count is not a safety signal here** — "562 tests passing" was
quoted in every commit trailer throughout the window in which a 2026-07-13 file was executing in
production, so a green suite was fully compatible with the largest defect in the project's history.
Second, **the honest response is not "add more unit tests"**: the platform boundary is real, and
faking `Strategy` would be a large piece of work of uncertain value. The response is to move the
assertions that *can* be made to where they are cheap and decisive — the deployed tree, the
effective-configuration export, and the compiler — which is what §15.4 proposes, and to leave the
remaining gaps open and named rather than papered over.
Also uncovered, carried from v7.0 and still true: no test asserts the **order** of the guard
sequence; no test asserts **parameter-set coherence** across the risk envelope; three of GAP-022's
eight scenario tests remain honestly deferred with their missing seams named (news-day sizing,
mid-trade disconnect, pre-entry disconnect); and GAP-007 walk-forward validation is blocked on a
gate ruling that has never happened.
### 15.3 The source-text test pattern — when it is legitimate and when it is fraud
Nine files in `tests/NT8.Core.Tests/Adapters/` read a `.cs` file from disk and assert on its
contents. Verified counts:
| File | Tests | What it asserts about the deployed-path source |
|---|---|---|
| `SimpleORBNT8DefaultsTests.cs` | 7 | Direction flags are set in `SetDefaults`; the telemetry `DailyBarContext` clone is direction-correct and uses the telemetry side and session open; the ORB range comes from the SDK opening-range tracker; AVWAP/trend telemetry fields are present with required formatting, omitted when `CustomData` keys are missing, and change neither scoring nor the `STATE:` line format |
| `NT8StrategyBaseMicroUpgradeTests.cs` | 5 | Persisted micro-upgrade state loads before the balance check; persistence writes after the existing message; init is account- and realtime-guarded; a corrupt file falls back to a reminder; the persistence file is account-scoped |
| `NT8StrategyBaseRejectSummaryTests.cs` | 4 | The snapshot is not suppressed by a blanket midnight-to-10:00 gate; the post-ORB flag resets per trading date; `OnBarUpdate` checks cadence on the live-bar heartbeat; the suppression window uses `OpeningRangeMinutes` |
| `NT8StrategyBaseBreakevenParamsTests.cs` | 3 | Breakeven parameters are hidden and marked unused; they are not read by order-flow methods; the settings export labels them unused |
| `NT8StrategyBaseOrderLifecycleTests.cs` | 3 | Every SDK order transition is logged to the session file; the `FILL:` line includes the signal name; existing callbacks are unchanged |
| `NT8StrategyBaseRunnerTrailTests.cs` | 3 | `SubmitOrderToNT8` does not call `SetStopLoss` on the runner signal after `SetTrailStop`; the runner monitor does not reset runner stops after entry; the seam adds no order-management indirection |
| `NT8StrategyBaseHistoricalGuardTests.cs` | 2 | `OnBarUpdate` does **not** block `State.Historical` before `_sdkStrategy.OnBar()`; `ProcessStrategyIntent` **does** block live-account historical orders before risk and submission |
| `NT8StrategyBaseRiskContractTests.cs` | 1 | `ProcessStrategyIntent` uses the quantity-aware risk interface call |
| `NT8StrategyBaseOnBarUpdateVisibilityTests.cs` | 1 | The `OnBarUpdate` catch block writes the exception to `FileLog` |
| **Total** | **29** | |
These are legitimate, and the reason is specific: **each one asserts a property of a file that
cannot be executed, and each one would fail if the property were removed.** Delete the `FileLog`
call from the catch block and
`NT8StrategyBaseOnBarUpdateVisibilityTests.OnBarUpdate_CatchBlockWritesExceptionToFileLog` fails.
Re-introduce a `SetStopLoss` call on the runner signal and
`SubmitOrderToNT8_RunnerSignal_DoesNotSetStopLossAfterTrailStop` fails. They are regression locks on
specific, named, previously-broken lines in code the harness cannot reach. That is a real service.
**The GAP-058 precedent is what the failure mode looks like.** Verified from `DEC-20260823-02`:
while independently reviewing Kilocode's GAP-048 commit (`e36534b`), Claude found three new tests in
`SimpleORBRejectionLoggingTests.cs`. Two were genuine — they called `OnBar` and
`RecordSignalRejection` through a reflection helper and asserted on the real emitted output. The
third, `RejectLineFormat_DiffersOnlyByReasonToken`, **hand-constructed two literal strings that had
been written to differ only by the `reason=` token, replaced that token with a placeholder in both,
and asserted the results were equal.** The assertion was true by construction. It called no
production code. It could not fail regardless of whether `NT8StrategyBase.cs` or
`SimpleORBStrategy.cs` actually preserved the line format — which is the only thing it appeared to
be testing. `DEC-20260823-02` classifies it as the same defect class as the GAP-022 precedent:
fabricated coverage that reads as a real regression test and tests nothing. It was tracked as
GAP-058 and replaced on 2026-08-23 with a test that drives `RecordSignalRejection` twice with
different reasons and diffs the two real emitted lines.
**The rule for telling the difference, and it is one question:**
> **Would this test fail if the production code were wrong?**
Applied mechanically, three checks separate the legitimate from the fraudulent:
| Check | Legitimate | Fraud |
|---|---|---|
| **Provenance of the asserted string** | Read from the production `.cs` file (or emitted by production code) at test time | Written into the test file by hand |
| **Failure mode** | Deleting or altering the production line makes the test red | Nothing you can do to production code makes it red |
| **Named subject** | Asserts a specific property that a specific defect violated, with the GAP or DEC ID in the test or its comment | Asserts a general shape, a formatting convention, or an equality between two things the test itself created |
A source-text test that passes all three is a regression lock on unexecutable code and should be
written without embarrassment. One that fails any of them should be deleted, not improved — as
`DEC-20260823-02` explicitly offered as an acceptable outcome ("or delete it if the two real tests
are judged sufficient coverage on their own"). **The worst outcome is the middle one: a
tautological test that raises the count, reassures the reader, and locks nothing.** That is how a
suite reaches 562 while a three-month-old file executes in production.
### 15.4 Recommended test additions
Ranked by the defect class each would have caught. None of these has been implemented; this document
changed no code.
| # | Test | Defect class it would have caught | Priority |
|---|---|---|---|
| **1** | **Deployed-vs-repo drift check.** Enumerate every `.cs` file in `bin\Custom\Strategies`; require each to match a known repo path by SHA-256; **fail on any file that matches no repo path.** Run as a `preflight.ps1` gate (exit non-zero), not an advisory, and as step 6 of the deployment runbook | **The deployed-source divergence (§6.3).** The orphan `SimpleORBStrategy.cs` matches no repo path and would have failed the second clause on its first run — in July. The existing `Write-DeployedSourceHashes` already collects exactly the hashes needed; nothing compares them. Also catches GAP-060's undeployed-fix class (`DEC-20260825-04`) and the `NinjaTrader.exe`-file-lock partial deploys | **CRITICAL** |
| **2** | **`SetDefaults`-effective-value test.** For every SDK parameter, assert the value *after* the full `OnStateChange(State.SetDefaults)` chain completes, not the value the subclass assigns. Where the class cannot be constructed, assert it against the newest `settings_*.txt` export as a fixture: parse the export and require each parameter to equal the documented intended value | **Finding 2 (§6.4), immediately.** `RunnerTrailTicks` intended 20, effective 12 — a one-line assertion against `settings_Simple_ORB_NT8_20260908_082122.txt` fails on sight. The same test makes `MinTradeGrade` 5→4, `MaxOpenPositions` 2→3 and `BarsRequiredToTrade` 50→1 visible in one run, and it makes `deploy-to-nt8.bat`'s unsatisfiable "verify `RunnerTrailTicks=20`" instruction impossible to leave in place | **CRITICAL** |
| **3** | **Property-shadowing detector.** Cross-compare the declared public property names of `NT8StrategyBase` and every subclass; fail on any name declared in both without the `new` keyword. Equivalently: promote compiler warning **CS0108** to an error in `Directory.Build.props` | **Finding 3 (§6.5).** All eight shadowed properties surface at build time, at zero runtime cost. Note this is one of the very few defects in this project's history that the *compiler already knew about* | **HIGH** |
| **4** | **Silent-early-return audit test.** For each method in the two NinjaScript-derived files that can `return` before writing evidence — `LogSignalRejectionFromContext`, `WriteSessionProvenance`, `WriteTradeProvenance`, `MaybeWriteRejectSummarySnapshot`, `InitFileLog` — assert by source text that every early-return branch is preceded by a `FileLog`/`Print` call naming the reason | **Doctrine rule 9 (§13), four instances.** `LogSignalRejectionFromContext:1509` returns on a missing `signal_reject_reason` key with no trace, which is the mechanism by which §6.3 stayed invisible for three months | **HIGH** |
| **5** | **Guard-order test.** Record the sequence of guard invocations for a synthetic intent and assert it matches the specified order: historical-replay block → dynamic-stop finalisation → trailing drawdown → portfolio risk → Tier 1 → sizing → circuit breaker → runner-mode resolution → submission | v7.0's Findings 2 and 3, both of which are consequences of ordering, and `DEC-20260818-09`'s sizing-reorder correction | HIGH |
| **6** | **Risk-envelope coherence property test.** Over the full `[Range]` product of `MaxStopTicks`, `MaxTradeRisk`, `MaxContracts`, `MinContracts`, `RiskPerTrade` and `DailyLossLimit`, assert no combination permits a single-trade loss above a declared worst case | GAP-045 and GAP-050. At live values, `$250 × 3 = $750` against a `$1,000` daily limit passes every current check | HIGH |
| **7** | **Reject-taxonomy distinctness test.** Assert each rejection path produces a distinct `reason` string, and that guard-fired and guard-misconfigured cases never share one | GAP-046 and GAP-048 (`TrailingDrawdownBreach` and `KillSwitch`, each overloaded). Doctrine rule 10 | MEDIUM |
| **8** | **Deploy-script contract test.** Assert that the file list in `deploy-to-nt8.bat`, the file list in `Verify-Deployment.ps1`, and the set of NinjaScript-derived sources in `src/` are the same set | The `MinimalTestStrategy.cs` disagreement: `Verify-Deployment.ps1:15` expects a file `deploy-to-nt8.bat` never copies. Two scripts, two contracts, neither authoritative | MEDIUM |
| **9** | **Manifest completeness test.** Assert every `deployment/backups/*/manifest.txt` records a git SHA, per-file SHA-256 and byte size, not just source and destination paths | 103 backup folders that cannot establish what was deployed. Provenance without hashes is a directory listing | MEDIUM |
| **10** | **Tick-value single-source test.** Assert `BasicRiskManager` and `BasicPositionSizer` return identical tick values for every symbol | GAP-052 latent divergence | LOW |
Tests 1, 2 and 3 are the ones that matter. Each is a few dozen lines. Between them they would have
caught the entire headline of v9.0 — the divergence, the effective-value inversion and the
shadowing — and two of the three run outside the NinjaTrader boundary entirely, which is exactly
why they are cheap.
### 15.5 Backtest validity rules
Mandatory, from `DEC-20260814-03` (verified verbatim against `docs/00-governance/decisions.md` this
session). These are not guidelines. A backtest violating any of them is invalid evidence.
1. **Strategy Analyzer start date at least 60 trading days before the target day.** In Strategy
Analyzer the secondary daily series loads only from the backtest start date. Below two daily bars
`BuildDailyBarContext` returns `Count=0` and the daily-dependent confluence factors score
neutral, pushing the composite below the Grade A threshold. Separately, the regime gate requires
50 daily bars (`CurrentBars[1] >= SmaPeriodLong`) and never arms on a short backtest. **Neither
path raises an error**, and the NR7 warm-up advisory deliberately does not block.
2. **Tick Replay enabled whenever the primary series is non-time-based** (HFT Algo Bars, range, tick
or volume). Without it, bar construction differs from live regardless of warm-up — which means
breakout bars differ, which means the strategy under test is not the strategy that runs.
3. **A zero-trade backtest is not evidence that no signal existed, and must not be cited as such.**
It is the expected result of violating rule 1. `DEC-20260814-03` is explicit that prior
single-day backtest results are **void as comparative evidence**.
4. **`SIGNAL:` / `SUBMIT:` / `STATE_DETAIL:` FileLog lines write only during `State.Realtime`.**
Grade, score and factor data are therefore unavailable in Strategy Analyzer output. Backtest
comparison must use NT8's native Trades-tab columns — entry/exit, P&L, MAE/MFE, bars-in-trade —
plus trade count, win rate, profit factor and average R.
5. **Any run with `EnableDynamicStop = true` predating 2026-08-18 must be re-baselined.**
`DEC-20260818-09` moved dynamic-stop finalisation ahead of sizing, correcting a real
contract-sizing defect and changing the results.
6. **`DaysToLoad` must actually take effect.** Rule 1 depends on it and GAP-044 says it currently
does not. The 2026-09-08 session loaded 36,303 historical minute bars reaching back to
`2026-03-06 10:20:00` against a configured `DaysToLoad=5`.
**One rule to add, new in v9.0:** *a backtest is evidence about the code that was compiled for it.*
Record the deployed-tree hash set alongside every Strategy Analyzer run, the same way `ConfigHash`
and `CodeVersion` are recorded for live sessions. Every backtest run between 2026-07-13 and today
was run against whichever `SimpleORBStrategy` the Strategy Analyzer bound — and if it bound the
`bin\Custom` orphan, the results describe the stale implementation. **This session could not
determine which copy Strategy Analyzer binds**; the test that settles it is to add a distinctive
log line to the repo copy only, deploy, recompile, and run a one-day backtest looking for that line.
Until that is done, treat all Strategy Analyzer output from the divergence window as provisional.
---
---
## 16. OPERATOR PLAYBOOK
### 16.1 Pre-market, 07:30–09:20 ET
| # | Step | Tool | Fail action |
|---|---|---|---|
| 1 | Run `preflight.ps1` | TOOL-003 | **Do not arm on any failure.** Fix and re-run |
| 2 | **Verify the deployed tree.** List every `.cs` in `Documents\NinjaTrader 8\bin\Custom\Strategies`, hash each, and compare against the repo. **Any file that matches no repo path is a stop condition** | Test 1 of §15.4 once built; manual `Get-FileHash` until then | **Do not arm.** Identify the orphan, move it out of `bin\Custom` (do not rely on the `@@` disable prefix), delete `NinjaTrader.Custom.dll`, recompile, re-verify. **New in v9.0, and it is the standing check this section previously lacked** |
| 3 | Confirm the deployed `NinjaTrader.Custom.dll` timestamp is later than the newest `.cs` in that folder | File explorer | If any source is newer than the DLL, NinjaTrader has not recompiled it. Delete the DLL and compile all NinjaScript |
| 4 | Confirm NT8 running, connection healthy, correct account | NT8 | — |
| 5 | Confirm **exactly one** strategy instance armed, one account, one instrument, one bar type | NT8 Strategies tab | Disable extras. Doctrine rule 5 |
| 6 | Run `configdiff` against `baseline.json` | TOOL-002 | **Any drift during a gate run ends the run** |
| 7 | Read the **effective** values in the newest `settings_*.txt`, not the source defaults. Spot-check `RunnerTrailTicks`, `MinTradeGrade`, `MaxOpenPositions`, `BarsRequiredToTrade`, `MaxTradeRisk` | Settings export | Any value that disagrees with the run plan is a stop condition. Doctrine rule 8 |
| 8 | Confirm `EnableKillSwitch = True` on the gate account | Settings export | Correct before arming. **Currently `False` live and flagged** |
| 9 | Confirm `TestMode = False` | Settings export | **Never arm with `TestMode` true.** This voided Gate Run #1 |
| 10 | Confirm `DaysToLoad` on the primary series matches intent | Session-log header | GAP-044 — currently failing. Record the discrepancy rather than proceeding silently |
| 11 | Confirm factor warm-up `SATISFIED` and the daily bar count is as expected | Session-log header | Investigate any drop; a 129→87 fall went unexplained for two weeks |
| 12 | Confirm the settings export for this session was written | Log directory | **A session without an export is unusable as evidence regardless of outcome.** This is the 2026-08-13 lesson |
### 16.2 During the session
| # | Step |
|---|---|
| 1 | Leave the NT8 Output window open on any diagnostic day — GAP-035's cross-check requires the file log and the Output window to agree |
| 2 | Watch `REJECT SUMMARY` counts on the dashboard. Post-GAP-048 these are distinguishable; a count against `TrailingDrawdownBreach` still cannot separate a real breach from an unconfigured floor |
| 3 | **On a `SIGNAL:` with no `SUBMIT:`, read the `REJECT:` detail immediately.** That is the v7.0 Finding 2 signature: the system found the trade and a risk gate declined it |
| 4 | **On `STATE:` lines with no `SIGNAL:` and no strategy-side reject reasons at all, go to §16.6.** That is the §6.3 signature and it is a different problem entirely |
| 5 | **Do not change parameters on an armed strategy.** Disarm first. Doctrine rule 4 |
| 6 | **Do not deploy or recompile during a gate run.** §2.6 |
| 7 | Avoid single-contract entries while GAP-054 is open — the informal workaround pending the follow-up diagnostic |
### 16.3 End of day
| # | Step |
|---|---|
| 1 | Confirm the session terminated cleanly and `REJECT SUMMARY` was written at `State.Terminated` |
| 2 | Reconcile any fills against the broker execution grid. **The grid is authoritative, not `trades_*.jsonl`** |
| 3 | Archive the day's session log, settings export and provenance JSON together. They are only useful as a set |
| 4 | Record the day's `ConfigHash` and `CodeVersion`. A change in either without a deliberate deploy is an incident |
| 5 | Note any anomaly in `docs/00-governance/current_status.md` using the handoff template |
| 6 | If the day produced zero `SIGNAL:` lines, say so explicitly in the note. Four such days were recorded as "quiet" before anyone treated the pattern as a defect |
### 16.4 Weekly, Sunday — mandatory per `DEC-20260816-01`
Republish `docs/00-governance/roadmap.md` and `current_status.md` before every Monday–Friday gate
week, permanently and without exception, whether or not anything material changed. Full process in
`docs/02-runbooks/weekly_roadmap_cadence.md`. The rule replaced a rolling seven-day heartbeat that
in practice drifted to whenever convenient, and it exists because on 2026-08-16 the tree was dirty
enough to fail two consecutive Gate 3 freeze attempts while `roadmap.md` and `current_status.md`
were two days stale against same-day decisions.
**The cadence has been running and producing nothing usable, and this document will not pretend
otherwise.** `DEC-20260816-01` includes a fallback clause: if repository access is unavailable at
trigger time, the scheduled review drafts from the Claude Project's stored artifacts and flags what
it could not verify, rather than skipping the week. That clause was written as a degraded mode. It
has become the only mode.
| Sunday | Repo access | Outcome |
|---|---|---|
| 2026-08-30 | None | Drafted from Project artifacts; state unverified |
| 2026-09-06 | None | Drafted from Project artifacts; state unverified |
| 2026-09-13 | None | Same state reported again, now against artifacts stamped 2026-09-08 |
| 2026-09-20 | None — the run's own notes record that **no `mcp__remote-devices__*` tools were present in the session at all** | Same state reported a second time. The review's §5 lists nine facts it could not verify, including `git status`, whether the GAP-064 fix was committed, and **"any `decisions.md` entries or `SPRINT_BOARD.md` changes made after 2026-09-08 — the entire 2026-09-09 through 2026-09-20 window (12 days) is invisible to this review"** |
Four consecutive runs, four unverifiable outputs. The 2026-09-20 run states the problem better than
this document could: it cannot distinguish between "nothing happened on the repo," "work is
happening but the sync channel stopped," and "this scheduled task has lost the repo-access path it
used to have." As it happens the first is true — HEAD is unchanged and `git status` is byte-identical
to its 2026-09-08 state — but the review had no way to know that, and **a governance control that
cannot tell "quiet" from "blind" is not a control.** Worse, it is actively corrosive: four
documents now exist that read like governance records and are in fact restatements of a
2026-09-08 snapshot.
**Recommended fix, in order of preference.**
| # | Fix | Effect |
|---|---|---|
| 1 | **Make the weekly review require device access.** Configure the scheduled task to require the operator's machine so the run has the repo, the deployed tree and the log directory. A run that fires without them should **fail loudly and notify**, not degrade to drafting | Turns four silent non-reviews into four visible alarms |
| 2 | **Failing that, move the cadence to an attended session.** A fixed Sunday slot the operator actually sits in, with the same checklist. Attendance is cheaper than a control that does not work | Restores verification at the cost of operator time |
| 3 | **Either way, make the artifact-only mode self-limiting.** A review that cannot verify repository state should produce a one-paragraph alert naming what it could not reach, and **must not** produce a full governance document — because a full document is what makes the gap invisible | Removes the false-reassurance failure mode |
| 4 | **Add a staleness tripwire.** If the newest `session_*.log` or the newest `decisions.md` entry available to the review is more than seven days old, escalate rather than report | Would have fired on 2026-09-13 |
This is `DEC-20260816-01`'s fallback clause working exactly as written and producing exactly the
wrong outcome. It should be amended.
### 16.5 Deployment runbook
The corrected procedure. Steps 6 and 7 are new in v9.0 and are the reason this runbook needed
rewriting.
| # | Step | Why |
|---|---|---|
| 1 | **Disarm the strategy. Confirm flat.** | Never deploy under an open position |
| 2 | **Close NinjaTrader fully.** Confirm no `NinjaTrader.exe` process remains | `NT8.Core.dll` file locks block `deploy-to-nt8.bat`, and a partially-completed deploy is how GAP-060's fix ended up correct in source and absent from the running binary (`DEC-20260825-01`, `DEC-20260825-04`) |
| 3 | **Confirm the working tree is clean and HEAD is the commit you intend to deploy.** `git status --porcelain` empty | Deploying from a dirty tree produces an artifact no commit describes. Note that today the deployed `NT8StrategyBase.cs` differs from the repo copy by exactly the one uncommitted `FileLog` line — the verified-good GAP-064 fix is neither committed nor deployed |
| 4 | **Build Release.** `dotnet build NT8-SDK.sln --configuration Release` | The script refuses to run without the three DLLs |
| 5 | **Run `deploy-to-nt8.bat`.** It creates a timestamped backup under `deployment/backups/` and copies three DLLs, two wrapper sources, `NT8StrategyBase.cs` and `SimpleORBNT8.cs` | Note what it does **not** copy: `SimpleORBStrategy.cs`, which ships inside `NT8.Strategies.dll` |
| 6 | **Orphan-file sweep — new in v9.0.** List every `.cs` in `bin\Custom\Strategies`. Account for each one against a repo path by SHA-256. **Anything unaccounted for is removed from `bin\Custom` entirely**, not disabled in place | This is the step whose absence is §6.3. As of this session the folder holds, besides the three current files: a 2026-07-13 `SimpleORBStrategy.cs`; `SimpleORBNT8Wrapper.cs` **and** `@@SimpleORBNT8Wrapper.cs`, both 9,838 bytes from 2026-02-16 — the same wrapper twice, once live and once disabled; `BaseNT8StrategyWrapper.cs` (2026-02-16); `MinimalTestStrategy.cs` (2026-02-17, which `Verify-Deployment.ps1` expects and `deploy-to-nt8.bat` never copies); `ORBFibPullbackV1.cs`; twelve further `@@`/`@`-prefixed strategies from 2025–2026; **four `SDK*.zip` archives and a `.DS_Store`** sitting inside NinjaTrader's compile directory. The `@@` prefix is a convention, not a guarantee — do not rely on it |
| 7 | **Delete `NinjaTrader.Custom.dll`** before reopening | Forces a clean full recompile. Without this, NinjaTrader may keep a stale assembly. Today's DLL is dated 2026-08-26 10:29 and contains the stale strategy |
| 8 | **Open NT8, compile all NinjaScript, confirm zero errors** | The `dotnet build` in step 4 does not produce the assembly NT8 runs |
| 9 | **Verify the deployed tree again, after the compile.** Hashes match, no unaccounted files, DLL newer than every source | A deploy is complete when the state is verified, not when the script exits zero. Doctrine rule 7 |
| 10 | **Start one session and verify effective configuration** against the new `settings_*.txt`: `ConfigHash` changed as expected, `CodeVersion` changed as expected, and every parameter in the run plan reads its intended value | Doctrine rule 8. This is where Finding 2 becomes visible if it recurs |
| 11 | **Grep the new session log for the behaviour you just deployed.** If the change added a log line, reject reason or telemetry field, confirm it appears | The cheapest possible proof that the deploy reached the running code. Zero occurrences of `RecordSignalRejection`, `signal_reject_reason`, `OrbRangeNotEstablished`, `RegimeVeto` and `trend_confirm_long` in the deployed strategy would have been visible from a single grep at any point in the last three months |
| 12 | **Record the deploy**: git SHA, per-file SHA-256, `ConfigHash`, `CodeVersion`, timestamp. Into `manifest.txt` if it is upgraded per §15.4 test 9; into `decisions.md` until then | 103 existing manifests record paths only and cannot establish what was deployed |
| 13 | Re-arm | — |
### 16.6 Incident response — when the log goes quiet
*New in v9.0.* This project has now hit the same failure signature at least three times — GAP-034
(2026-08-14), GAP-060 (2026-08-24) and GAP-064 (2026-09-04) — and spent weeks on each. The
signature is specific: **telemetry present, signals and rejects absent.** Use this tree the first
time you see it, not the third.
**The signature.** On a full RTH session:
```
[from session_20260908_082122.log — 12,161 lines, 08:21:22 → 19:07:39 ET]
STATE: 115 <-- telemetry is alive
SIGNAL: 0 <-- no intent ever reached the log
OrbRangeNotEstablished 0 <-- no strategy-side reject reason either
GradeFilter 0
HistoricalReplayCatchup 11,709 <-- the replay burst, all in ~1 second at startup
```
The decisive fact is that `SIGNAL:` is written **unconditionally** at the top of
`ProcessStrategyIntent` in realtime (`NT8StrategyBase.cs:2098–2099`), before any risk, sizing or
submission check. Zero `SIGNAL:` lines across a full RTH session therefore proves `intent == null`
on every RTH bar. Nothing downstream — not `MaxTradeRisk`, not the trailing-drawdown monitor, not
the circuit breaker — can produce this pattern. That is what makes the diagnosis tractable, and it
is the single most useful fact in this section.
```
Full RTH session, 0 SIGNAL: lines
│
┌───────────────────┴───────────────────┐
│ │
Are STATE: lines present? No STATE: either
│ │
│ ┌────────────┴─────────────┐
│ │ Strategy not armed, not │
│ │ realtime, RTH guard, or │
│ │ OnBarUpdate throwing on │
│ │ every bar. Check the │
│ │ session header, then the │
│ │ GAP-064 FileLog fix at │
│ │ NT8StrategyBase.cs:855 │
│ └──────────────────────────┘
│ YES — the bar loop is running and the base class is alive
▼
Are ANY strategy-side reject reasons present?
(OrbRangeNotEstablished / GradeFilter / RegimeVeto / MaxDailyTrades)
│
┌───────┴────────┐
│ │
SOME NONE ◀── this is the §6.3 signature
│ │
▼ ▼
The strategy ═══ STEP 1: VERIFY THE DEPLOYED FILE. DO NOT DEBUG SOURCE. ═══
is deciding grep -c RecordSignalRejection \
and declining. "$USERPROFILE/Documents/NinjaTrader 8/bin/Custom/Strategies/SimpleORBStrategy.cs"
Read the │
reject reasons ┌──────────┴──────────┐
and go to 0 occurrences 11 occurrences
the ORB / (deployed file is (deployed file is current)
grade path stale — you have │
in §6. found it) ▼
│ ═══ STEP 2 ═══
▼ Compare deployed vs repo by
§16.5 steps SHA-256 for ALL THREE files;
6–11, then check the DLL timestamp is
re-observe one newer than every source.
full RTH session A stale DLL is the same defect
before any with a different cause
further diagnosis (DEC-20260825-04).
│
▼
═══ STEP 3 ═══
Only now is it a code defect.
Stage a bar-trace prompt
(TASK_GAP064_FOLLOWUP2_ONBAR_TRACE)
and instrument the ORB-range
and breakout-confirmation path.
```
**The rules that make this tree work.**
| Rule | Why |
|---|---|
| **Steps 1 and 2 cost five minutes. Step 3 has cost this project three months, twice.** Never invert the order | GAP-034 and GAP-064 were both worked as step-3 problems for weeks. Both were step-1 problems |
| **Absence of reject reasons is stronger evidence than absence of signals** | A strategy that declines every bar still *records why*. Silence across the whole reject taxonomy means the code that writes reject reasons is not running — which is a deployment question, not a logic question |
| **`LogSignalRejectionFromContext` returns silently on a missing key** (`NT8StrategyBase.cs:1504`, guard at `:1509`) | So a stale strategy produces exactly this signature: base-class telemetry intact, strategy-side reasons gone. Knowing this one mechanism collapses the whole diagnosis |
| **Do not restart the strategy before capturing the evidence** | A restart replaces the session log's startup context and re-runs the replay burst. GAP-064's task prompt explicitly instructs not to restart until the diagnostic completes, and three weekly reviews were unable to confirm whether that instruction was honoured |
| **Do not close the gap as "correct filtering"** | Earlier reviews proposed closing GAP-034 as "correct Grade-A filtering." v9.0's position is that it was very probably the stale-file defect all along. A zero-signal day is a defect hypothesis until the deployed tree has been verified — never a market explanation |
---
---
## 17. SYSTEM CONSTRAINTS — WHAT THIS SYSTEM WILL NOT DO
These are boundaries, not backlog items. Each one is a property of the platform, the language
target or the data available, and no amount of roadmap will move it without a deliberate
architectural decision recorded in `decisions.md`.
### 17.1 Hard architectural constraints
| Constraint | Consequence |
|---|---|
| **`net48` is the ceiling.** All seven projects target `net48`; there is no multi-targeting. Verified this session across every `.csproj` and `Directory.Build.props` | No `System.Text.Json`, no `Span`-based APIs, no modern `async` primitives, no nullable reference types, no `record` types. Library choice is bounded by what still ships a `net48`-compatible package. Migrating is not a build-flag change: NinjaTrader 8 hosts the assemblies in its own .NET Framework process |
| **C# 5.0 syntax only in NinjaScript-bound files** | No `?.`, no string interpolation, no expression-bodied members, no `nameof`. `rules/nt8compilespec.md` and `docs/00-governance/compile_guardrails.md` carry the rules. This is the most common cause of compile failures in the project's history |
| **`NT8.Core` cannot reference NinjaTrader types.** Verified and maintained: zero `using NinjaTrader.*` anywhere in 74 files / 22,209 lines | Any logic that needs `Bars`, `Account`, `Order`, `Execution`, `CalculationMode` or `State` belongs in `NT8.Adapters`, not `NT8.Core`. A prompt that would add such a reference must be rejected and the logic redirected — this invariant is the single largest architectural asset the project has, and it is what makes a second broker adapter realistic rather than a rewrite |
| **NinjaScript-derived classes cannot be instantiated in tests.** `NT8StrategyBase` and `SimpleORBNT8` derive from `NinjaTrader.NinjaScript.Strategies.Strategy`, which requires platform state the test host cannot supply | 3,688 lines of production code have **no execution coverage**, only 29 source-text assertions. §15.2. This is not a gap to be closed by effort; it is a boundary to be worked around, which is what §15.4's tests 1–3 do |
| **Managed orders only** | Unmanaged order handling is out of scope. All submission goes through `EnterLongManaged`/`EnterShortManaged` |
| **`SetStopLoss`, `SetProfitTarget` and `SetTrailStop` are signal-scoped and mutually exclusive per signal name.** The later call **replaces** the earlier exit order | A signal name can carry a fixed stop or a trail, never both. GAP-054 is entirely a consequence. `NT8StrategyBase.cs:807–815` carries the source comment; the two traps are calling `SetStopLoss` on a trailing signal (destroys the trail) and re-calling `SetTrailStop` in `OnBarUpdate` (resets the anchor to bar-close price). **There is no API for "trail, but never worse than breakeven"** — that behaviour must be synthesised from a single method per signal, or expressed as two legs |
| **No strategy-level bypass of risk validation** | Doctrine rule 1 |
### 17.2 Platform constraints
| Constraint | Consequence |
|---|---|
| **`Calculate = OnBarClose`.** Set in `SetDefaults` on both base and subclass; `5 Minute` primary series live | **Every decision this system makes is a bar-close decision.** Entry confirmation, breakeven triggers, trail evaluation, reject-summary cadence and telemetry all fire at most once per bar. Signal latency is bounded below by bar duration — on a 5-minute series, up to five minutes. The configured 20-tick breakeven trigger has been observed firing at 24–28 ticks for exactly this reason: **the parameter does not mean what it says.** Changing to `OnEachTick` is not a setting change; it would alter every confirmation and exit assumption in the system |
| **No tick-level logic exists anywhere in the SDK.** There is no tick handler, no intra-bar state machine and no sub-bar exit management | Fill quality, slippage response, intra-bar stop placement and any scalping or microstructure strategy are out of scope by construction. The one exception is delegated entirely to NinjaTrader: `SetTrailStop` is managed natively tick-by-tick by the platform, which is why destroying it with a `SetStopLoss` call is so expensive |
| **Every `.cs` under `bin\Custom` is compiled into `NinjaTrader.Custom.dll`, and C# binds a source type over a referenced-assembly type of the same name** | This is the mechanism of §6.3, and it is permanent platform behaviour, not a bug to be fixed. It means the deployed tree is part of the system's definition and must be verified as such |
| **`DaysToLoad` is not settable from this codebase.** A full-repo search confirms nothing sets or overrides it for `BarsArray[0]` | Historical data depth is NinjaTrader workspace or Strategies-dialog state. GAP-044, currently misbehaving |
| **FileLog lines write only in `State.Realtime`** | Grade, score, factor and reject data are unavailable in Strategy Analyzer output. §15.5 rule 4 |
| **A recompile changes `CodeVersion` but not `ConfigHash`** | Why the code stamp exists (`DEC-20260714-01`), and why a mid-gate recompile silently voids a run |
| **Strategy Analyzer loads the secondary daily series only from the backtest start date** | The mandatory 60-trading-day warm-up. §15.5 rule 1 |
| **`HFTAlgoBarsType` is third-party** | Vendor dependency with no in-repo fallback. GAP-043 |
### 17.3 Scope and data constraints
| Constraint | Consequence |
|---|---|
| **Single account, single instrument, single strategy instance today.** `PortfolioRiskManager` is a singleton keyed by `strategyId` with **no account dimension** (GAP-042) | Two strategies on different accounts would have their daily P&L and open-contract counts aggregated together incorrectly. Multi-strategy on **one** account is safe; multi-account is not. Live today: account `SimSimple ORB`, instrument `NQ SEP26`, one instance. Everything in the 24×5 roadmap sits behind GAP-042 |
| **`MaxDailyTrades` does not survive a restart** | `_dailyTradeCount` is an in-memory field. A gate run under `MaxDailyTrades = 1` cannot currently guarantee one trade per day (GAP-055) |
| **No commission or slippage model in the expectancy math.** `Slippage = 0` in `SetDefaults`; commission is applied by hand in analysis at $2.88 per side | The expectancy model is **gross**. On the four broker-confirmed trades commission was $69.12 against $1,105.00 gross — **6.3% of gross P&L**, and larger than the runner leg's entire net contribution of $1.96. At one trade per day with a three-contract dual-leg structure this is a first-order term, not a rounding error, and **no backtest or gate ruling produced by this system is net of costs unless it is calculated separately** |
| **No Level II subscription** | `LiquidityMonitor` depth values are hardcoded |
| **No execution-latency instrumentation** | The latency fields in the dashboard contract cannot be populated |
| **No news or economic calendar** | The news-day reduced-sizing scenario test remains honestly deferred with its missing seam named (GAP-022) |
| **Two hardcoded tick-value tables** in `BasicRiskManager` and `BasicPositionSizer` | Per-instrument configurability requires consolidating them first (GAP-052) |
---
---
## 18. GOVERNANCE, CADENCE AND CONTINUITY
### 18.1 Artifact authority
See §2.4. v9.0 adds the rule that the deployed artifact outranks the repository.
### 18.2 Session-start load order for any LLM
1. This document, §1 and §6. 2. `SPRINT_BOARD.md`. 3. `decisions.md`, newest entries first. 4. `git log --oneline -20` and `git status`. 5. **Diff the deployed NinjaTrader Strategies folder against the repo** — new in v9.0, and non-optional. 6. The newest `session_*.log` and its paired `settings_*.txt`. 7. Any staged `TASK_*.md` not yet picked up. **Never begin from a cached copy or from recollection of a prior session.**
### 18.3 Weekly cadence — `DEC-20260816-01`
Republish `roadmap.md` and `current_status.md` every Sunday, permanently. **Amended in v9.0:** a review that cannot reach the repository must say so in its first line and must not produce a gate/no-gate determination, because it has no basis for one. P0-F fixes the access problem; until it lands, this amendment prevents four more weeks of confident blindness.
### 18.4 Division of labour
Operator runs everything that touches the live platform. Kilocode makes all `src/` changes via `TASK_*.md` prompts. Claude authors task prompts, records decisions, and verifies implementations by reading diffs — and never modifies source. Claude has no code-execution access on the operator's machine; treat any Claude claim about runtime behaviour as unverified until the operator runs it.
### 18.5 The documentation-verification requirement
Every parameter default, formula and control this document describes carries a source citation and is re-verified against source at each revision. **Extended in v9.0:** every *effective* value must be verified against the live settings export, not only against source defaults. Finding 3 is what the unextended rule missed.
### 18.6 What v9.0 could not verify
| Item | Why not | How to close it |
|---|---|---|
| Whether Strategy Analyzer binds the orphan or the DLL (GAP-076) | Requires running the analyzer | Add a distinctive log line to the repo copy only, deploy, recompile, run a one-day backtest, grep for it |
| Whether GAP-071 (`Mode1DualLeg` + qty=1) actually double-submits | No session log shows that configuration | Strategy Analyzer run with `RunnerActivationMode=Mode1DualLeg`, `MaxContracts=1`; assert `SUBMIT Scaler=1 Runner=1` never occurs |
| When and how the orphan file was placed | No provenance for a hand-copied file | Not recoverable; prevented going forward by P0-B |
| Whether GAP-030 and GAP-055 are live | Both live in `SimpleORBStrategy.cs` | P1-F, after P0-A |
| Whether the 580-test figure still holds | No test run this session (read-only mandate) | `verify-build.bat` after P0 |
| Whether the four broker-confirmed trades were affected by the divergence | They predate the log evidence window this revision examined | Compare their session logs' reject taxonomy against the post-P0-A baseline |
| Why `DaysToLoad=5` loads 36,303 bars back to 2026-03-06 | Not investigated this revision | GAP-044 |
### 18.7 Handoff template
```
State as of :
HEAD , branch , ahead of origin, tree clean/dirty
Deployed tree verified against repo: YES / NO ← if NO, stop and fix
Live strategy: running since / stopped since
Last session log: , rejects present: YES / NO
Open blockers:
In flight:
Next action:
```
---
## 19. DEFINITION OF DONE — PRODUCTION SYSTEM
Nothing on these lists is checked. This document changed no code and validated no run.
### 19.1 Core system
- [ ] All CRITICAL and HIGH gaps in the §7 register closed, or formally deferred with a recorded risk acceptance
- [ ] **The deployed-source divergence (§6.3) closed: the orphan `SimpleORBStrategy.cs` removed from `bin\Custom`, `NinjaTrader.Custom.dll` rebuilt clean, and one full RTH session observed emitting strategy-side reject reasons**
- [ ] **Finding 2 closed: `base.OnStateChange()` ordering corrected, and every parameter's effective value confirmed equal to its intended value in a live `settings_*.txt` export**
- [ ] **Finding 3 closed: all eight shadowed properties resolved, and compiler warning CS0108 promoted to an error**
- [ ] GAP-054 closed on its own evidence, with a SIM trade showing a runner trail that ratchets
- [ ] GAP-034 re-ruled in light of §6.3 — **not** closed as "correct Grade-A filtering"
- [ ] GAP-064 closed with a full RTH session producing `SIGNAL:` or an explicit strategy-side reject reason on every bar
- [ ] Working tree clean; 44 unpushed commits pushed; freeze captured; `baseline.json` matches the running `CodeVersion`
- [ ] Risk envelope coherent and asserted at startup
- [ ] Factor weighting decided, implemented and recorded
- [ ] Runner decision made and backtest-validated
- [ ] 562 tests passing, plus §15.4 tests 1–3 at minimum
- [ ] NinjaScript compiles clean, with zero warnings suppressed
- [ ] `src/NT8.Contracts/` either populated or removed from the solution
### 19.2 Validation
- [ ] Gate Run #3 complete: ≥2 calendar weeks **and** ≥20 broker-confirmed `RTH_ORB` trades, single frozen account, instrument, bar type and `ConfigHash`
- [ ] **Every trade in the sample traceable to a verified deployed-tree hash set, not just a `CodeVersion`**
- [ ] Ruling recorded against the §9 outcome matrix, including the stopping rule
- [ ] GAP-007 walk-forward passes with ≥60% PF retention
- [ ] Grade-versus-outcome correlation measured — **never done, and it is the question the ten-factor system exists to answer**
- [ ] Long and short expectancy measured separately; the short side currently has zero confirmed samples
- [ ] Cost model built net of commission and measured slippage
- [ ] All backtests cited as evidence satisfy every §15.5 rule, including the new deployed-hash rule
### 19.3 Observability
- [ ] Reject taxonomy split and unambiguous, with guard-fired distinguishable from guard-misconfigured
- [ ] **No silent early return in any evidence-writing path; every early return logs its reason**
- [ ] Dashboard headline Score and Grade match the trade path, or are explicitly labelled advisory
- [ ] `configdiff` runs as a **failing** preflight check, not an advisory one
- [ ] **Deployed-vs-repo drift check runs as a failing preflight check and as a deployment-runbook step**
- [ ] `trades_*.jsonl` verified clean for a full gate run
- [ ] Rejection analysis with forward MFE/MAE available
- [ ] A single grep against a fresh session log can confirm that any deployed change is live
### 19.4 Operational
- [ ] Single frozen account, instrument and bar type maintained for a full gate run with zero drift events
- [ ] Deployment runbook (§16.5) followed end to end, with zero mid-gate deploys and a completed orphan sweep on every run
- [ ] **Every deploy recorded with git SHA, per-file SHA-256, `ConfigHash` and `CodeVersion` — not paths alone**
- [ ] Weekly Sunday cadence maintained **with verified repository access**, no missed week, and no week reported from artifacts alone
- [ ] Trailing-drawdown monitor configured and `AccountItem.NetLiquidation` validated against the NT8 account display with an open position
- [ ] Kill switch confirmed working and `True` on the gate account
- [ ] `MaxDailyTrades` persistence confirmed across a restart within one CME trading date
### 19.5 Documentation
- [ ] Every parameter, formula and control in the master document carries a source citation **and an effective-value citation from a settings export**
- [ ] No governance document presents a completed task as open, or an undeployed fix as deployed
- [ ] `docs/00-governance/current_status.md` and `active_work.md` current to within seven days
- [ ] Master document revision includes a "what I could not verify" section
- [ ] `deploy-to-nt8.bat` and `Verify-Deployment.ps1` agree on the deployment contract, and neither instructs the operator to verify an unsatisfiable value
- [ ] `tools/market-data` and `tools/replay` either implemented or removed, so the tool inventory means what it says
---
---
## 20. HARD-WON GUARDRAILS
Every row cost something. Where the cost is known in money, time or voided evidence, it is stated.
| # | Guardrail | What it cost to learn |
|---|---|---|
| 1 | Never run a gate with `TestMode = True` | 67 round-trips and three months, April–July 2026. Gate Run #1 void; its measured 23.9% win rate, 0.86 PF, −$1,335.92 and −$3,201.40 max drawdown describe a different strategy and must never be cited for or against the ORB edge |
| 2 | One account, one config, one instrument, one bar type per gate run | Gate Run #2 void, and recurring after the rule was written — 2026-08-11, 08-13, and 08-18, when two instances traded the same account and instrument concurrently and nine distinct `ConfigHash` values appeared in one day |
| 3 | Completion claims must cite grep-verifiable evidence | Two governance incidents in July, in opposite directions: a sprint board showing twelve tasks green against a HEAD that could not compile, and a governance rewrite re-queueing twelve tasks that were already implemented |
| 4 | A recompile changes behaviour without changing `ConfigHash` | `DEC-20260714-01`; the reason `CodeVersion` exists at all |
| 5 | `ConfigHash` must include `BarsPeriod` | Three settings exports, three different bar types, one identical hash |
| 6 | Provenance writes must share the session-log directory fallback | Provenance missing for four broker-confirmed trades — 2026-08-07, 08-10, 08-16, 08-17 — the entire broker-confirmed record at the time |
| 7 | Provenance writes must be gated on `State.Realtime` | 57 phantom rows written in a 14-second restart replay window, with no matching broker activity |
| 8 | Order submission must be gated on `State.Realtime` | Historical catch-up bars produced full intent-to-fill sequences. In the 2026-09-08 session the burst was 11,709 events in roughly one second |
| 9 | Backtests need a 60-trading-day warm-up and Tick Replay | Zero-trade backtests misread as "no signal existed." `DEC-20260814-03` voids all prior single-day backtest results as comparative evidence |
| 10 | Deferring a test honestly, with the missing seam named, beats fabricating coverage | GAP-022's 5-of-8. The counter-example is GAP-058, below |
| 11 | A review that sees one data channel will confidently reach wrong conclusions | v6.3 invented six gap numbers (GAP-031–036) that collided head-on with a real register, and concluded the project had gone dark for two weeks while the repository had been updated continuously. v6.4 spent its revision renumbering |
| 12 | Documentation drift in a risk system is a risk-control failure, not a documentation problem | v7.0's Findings 1 and 3: the factor weighting scheme and the `MaxTradeRisk` quantity term were both described by the master document and absent from the code, for months, in live risk controls |
| 13 | A rejection taxonomy that merges causes destroys the diagnostic value of the log | 647 rejections labelled `KillSwitch` on 2026-08-17 (a genuine kill switch) and 5 labelled `KillSwitch` on 2026-08-18 (Tier 1 per-trade risk), indistinguishable in `REJECT SUMMARY`, which aggregates on `reason` |
| 14 | Enabling a safety feature without its required companion setting is a hard outage | `EnableTrailingDrawdown = True` with `AccountStartingBalance = $0.00` blocked every entry from 14:30 ET on 2026-08-18 — 27 rejections, a full afternoon |
| **15** | **The deployed artifact outranks the repository. Verify the deployed tree file by file, including files the repository does not know about** | **The largest single cost in this project's history.** A 2026-07-13 copy of `SimpleORBStrategy.cs` (1,189 lines / 51,465 bytes) shadowed the repo's 1,531-line version from at least 2026-08-26. Every strategy-side reject reason absent from the log for ~3 months; GAP-064 and almost certainly GAP-034 misdiagnosed for weeks each; **GAP-062's entire fix never live** despite `DEC-20260826-01` recording it as deployed, voiding three weeks of "GAP-062 SIM validation overdue." `preflight.ps1` check 5 passed throughout, because it compares exactly one of the three files |
| **16** | **A file that is never copied is never verified. Any deploy check restricted to expected files cannot find an unexpected one** | The same incident, stated as the mechanism. `deploy-to-nt8.bat` performs seven `if not exist` checks and zero content checks; `Verify-Deployment.ps1:15` expects a file the batch script never copies; 103 `manifest.txt` files record paths with no hashes, no git SHA and no sizes — so the deployment history cannot establish what was ever deployed |
| **17** | **Call `base.OnStateChange()` first, not last. A base-class `SetDefaults` block runs after yours and overwrites it** | `SimpleORBNT8.cs:163`. Four live parameters have been wrong since the file was written: `RunnerTrailTicks` 20→**12** (a real risk parameter — the strategy has been trading a trail 40% tighter than its own subclass asked for), `MinTradeGrade` 5→**4**, `MaxOpenPositions` 2→**3**, `BarsRequiredToTrade` 50→**1**. All four confirmed in `settings_Simple_ORB_NT8_20260908_082122.txt`. `deploy-to-nt8.bat` has meanwhile been instructing the operator to "Verify defaults: … RunnerTrailTicks=20" — **a check that cannot pass from source defaults**, and which presumably has been ticked off many times |
| **18** | **Never re-declare a base property in a derived class without the `new` keyword. Two backing values under one name is not an override** | Eight properties declared in both `NT8StrategyBase` and `SimpleORBNT8` — `EnableBarBasedRearm`, `EnableShortTrendFilter`, `EnableCMEHolidayGuard`, `EnableATRTrailing`, `ATRTrailingPeriod`, `ATRTrailingMultiplier`, `ATRTrailingMinTicks`, `ATRTrailingMaxTicks`, all verified present in both files this session. Base-class code reading `this.EnableATRTrailing` reads the **base** copy, not the value in the operator's property grid — a latent hazard sitting directly in the ATR-trailing and short-trend-filter paths. Cost so far: nothing realised, which is luck. **The compiler knew: CS0108 warns on exactly this and is evidently not an error in this build** |
| **19** | **An agent's source audit is a hypothesis, not a finding, until it is independently re-verified against the deployed artifact** | `DEC-20260825-06` lifted the hold on GAP-062 — a real scoring-behaviour change — partly on "a full audit of all 10 confluence factor calculators" concluding Trend was the only defective one. The audit may well be correct; **it has never been checked against what executes**, and the fix it authorised turned out never to have been live at all. The adjacent precedent is GAP-058 (`DEC-20260823-02`): a test that read as a real regression test, hand-constructed both sides of its own assertion, and could not fail — caught only because Claude read the diff instead of the summary. Cost: an unvalidated behaviour change reaching the live install, and a test in the suite for months that locked nothing |
| **20** | **A review that cannot reach the thing it reviews must fail loudly, not degrade to drafting** | **Four consecutive weekly governance reviews — 2026-08-30, 09-06, 09-13, 09-20 — ran with no repository access and produced unverifiable output.** `DEC-20260816-01`'s fallback clause permitted exactly this, so nothing looked broken. The 2026-09-20 run states it plainly: it could not distinguish "nothing happened" from "the sync channel stopped" from "this task has lost its access path," and 12 days were invisible to it. Cost: four documents that read as governance records and are restatements of a 2026-09-08 snapshot, plus the loss of the one control that was supposed to catch a two-week stall — which was, in fact, happening |
---
## APPENDIX A — DECISION LOG INDEX
The authoritative log is `docs/00-governance/decisions.md`. Entries most load-bearing for v9.0:
| ID | Date | Subject | v9.0 status |
|---|---|---|---|
| `DEC-20260814-01` | 08-14 | GAP-034 silent zero-trade defect; GAP-035 prerequisite | **Reopened** |
| `DEC-20260814-03` | 08-14 | Backtest validity rules (60-day warm-up, Tick Replay) | Current; §15.5 |
| `DEC-20260816-01` | 08-16 | Weekly Sunday cadence | **Amended** — §18.3 |
| `DEC-20260818-18` | 08-18 | GAP-054 runner breakeven removal | Fix live; **validation failed** |
| `DEC-20260819-01` | 08-19 | MNQ cutover sequencing | Gating conditions unmet |
| `DEC-20260823-01` | 08-23 | GAP-047 designed confluence weights | Live in `NT8.Core`; study population suspect |
| `DEC-20260825-04` | 08-25 | Zero trades; `Trend=0.30`; `trend_confirm` direction-blindness | **Still an accurate description of the live system** |
| `DEC-20260825-06` | 08-26 | GAP-062 hold lifted | Fix **never live** |
| `DEC-20260826-01` | 08-26 | GAP-062 implemented and deployed | **Corrected** — deployed but shadowed |
| `DEC-20260826-02` | 08-26 | Deploy-status contradiction caught by diff verification | Precedent for §20 guardrail 15 |
| `DEC-20260902-01` | 09-02 | GAP-054-FOLLOWUP staged | Never picked up |
| `DEC-20260904-01` | 09-04 | GAP-064 finding | **Superseded** — root cause found |
| `DEC-20260908-01` | 09-08 | GAP-064 verification; commit recommended | Recommendation still outstanding |
| `DEC-20260922-01` | 09-22 | **This revision: deployed-source divergence, GAP-065–076** | New |
---
## APPENDIX B — REJECT REASON REFERENCE
| Reason | Emitted by | Reaches disk | Present in live logs? |
|---|---|---|---|
| `RthGuard` | Adapter, `OnBarUpdate` | ✅ | ✅ |
| `WarmupIncomplete` | Adapter, 5 sites | ✅ | ✅ |
| `HistoricalReplayCatchup` | Adapter, `ProcessStrategyIntent` | ✅ (exempt from the realtime gate) | ✅ |
| `CmeHoliday` | Adapter + strategy | ✅ | ✅ (holiday sessions) |
| `KillSwitch` | Adapter | ✅ | — |
| `PortfolioRisk`, `MaxTradeRisk`, `CircuitBreaker`, `LongTradesDisabled`, `ShortTradesDisabled`, `SizeBelowMinContracts`, `TrailingDrawdownBreach`, `TrailingDrawdownNotConfigured` | Adapter, `ProcessStrategyIntent` | ✅ | — |
| **`OrbRangeNotEstablished`** | **Strategy**, via `context.CustomData` | ✅ in repo | ❌ **absent — GAP-065** |
| **`GradeFilter`** | **Strategy** | ✅ in repo | ❌ **absent — GAP-065** |
| **`RegimeVeto`** | **Strategy** | ✅ in repo | ❌ **absent — GAP-065** |
| **`MaxDailyTrades`** | **Strategy** | ✅ in repo | ❌ **absent — GAP-065** |
The dividing line in the last four rows is the whole of Finding 1.
---
## APPENDIX C — FILE AND DIRECTORY MAP
**C.1 Repository, `C:\dev\nt8-sdk`** — `src/{NT8.Core, NT8.Adapters, NT8.Strategies, NT8.Contracts, _archive}`, `tests/{NT8.Core.Tests, NT8.Integration.Tests, NT8.Performance.Tests}`, `docs/{00-governance, 01-specs, 02-runbooks, api, architecture, archive, deployment, gate-runs}`, `deployment/{NT8, backups×103, dev, prod, staging}`, `tools/{configdiff, dashboard, logtriage, logwatch, market-data, preflight, replay, rescore, runnersweep}`, `Specs/SDK`, `.kilo/worktrees`, root `TASK_*.md` prompts and `SPRINT_BOARD.md`.
**C.2 Runtime, `…\NinjaTrader 8\log\nt8-sdk`** — `session_*.log`, `settings_*.txt`, `provenance_*.json`, `trades_*.jsonl`, `daily_trade_count_*.json`, `micro_upgrade_suggested_*.json`, `ARCHIVE/`.
**C.3 Deployed target, `…\NinjaTrader 8\bin\Custom`** — three SDK DLLs; `Strategies/` holding `NT8StrategyBase.cs`, `SimpleORBNT8.cs`, the two wrappers, `MinimalTestStrategy.cs`, **the orphan `SimpleORBStrategy.cs` (GAP-065)**, a duplicate `@@SimpleORBNT8Wrapper.cs`, twelve unrelated `@@`/`@` strategies, four `SDK*.zip` and a `.DS_Store`; and `NinjaTrader.Custom.dll`, the assembly NinjaTrader compiles from all of it. **This directory is rank-4 evidence and must be read at every session start.**
---
## APPENDIX D — GATE 3 CONFIGURATION
`freeze_20260816_170304` is **discarded** per §9.2 D-2. A fresh freeze is P1-G. The recommended frozen parameter set is §5.19. The freeze capture must additionally record: the SHA-256 of every `.cs` in the deployed Strategies folder, the `NinjaTrader.Custom.dll` timestamp, `ConfigHash`, `CodeVersion`, `BarsPeriod`, and the effective post-initialisation value of every parameter in §5 — not the source default.
---
## APPENDIX E — BROKER-CONFIRMED TRADE LEDGER
| # | Date | Account | Result | Note |
|---|---|---|---|---|
| 1 | 2026-08-07 | Bulenox | +$227.72 net | Scaler produced 100% of P&L; runner +1 tick |
| 2 | 2026-08-10 | Bulenox | +$262.72 net | Runner exactly $0; breakeven fired at +25 ticks, 3 ticks before target |
| 3 | 2026-08-16 | My NinjaTrader | +$277.72 | 19:12 ET — ETH, not an RTH_ORB trade |
| 4 | 2026-08-17 | My NinjaTrader | +$267.72 | Second trade on one CME date under `MaxDailyTrades=1` — the breach that produced GAP-055 |
| 5 | 2026-09-01 | SimSimple ORB (SIM) | **−$200.76** | `Mode2RunnerOnly`, ~+$1,200 MFE. **The GAP-054 evidence** |
Aggregate is not a sample. Trades 1–4 predate the log window this revision examined; whether the divergence affected them is listed in §18.6 as unverified.
---
## APPENDIX F — VISUAL PACK
`docs/NT8_SDK_v7.0_Visual_Pack.html` remains the current companion and is not regenerated for v9.0. A v9.0 pack should add one panel: the intended-versus-actual compilation path diagram from §4.4, which is the single most useful picture in this document.
---
*End of NT8-SDK Master Document v9.0.*