Companion to NT8_SDK_Master_Document_v7.0_Complete.docx · rev B · evidence as of 2026-08-18 · repo C:\dev\nt8-sdk @ f617574
1 · Nine-layer architecture
Layers 1–8 are platform-free. Layer 9 is the only one that imports NinjaTrader. That separation is real and maintained — it is what makes a broker-neutral platform achievable rather than a rewrite. The status column is honest about which layers are actually load-bearing today.
Dead code worth knowing about:RegimeManager, TrendRegimeDetector and VolatilityRegimeDetector are instantiated in Layer 2 but never called in the live signal path (DEC-20260817-04). The regime values actually used come from inline SMA20/50 arithmetic in BuildStrategyContext().
2 · The bar-to-trade pipeline
Eighteen stages between a bar closing and an order reaching the broker. The order matters: SIGNAL: is written at stage 8, before every risk gate, which is what makes a silent day diagnosable. Red rows are where trades died on 2026-08-18.
1
CME holiday guard
CmeHoliday
clear
2
Connection state
— (bar skipped)
clear
3
Kill switch
KillSwitch
off today
4
Warm-up — first realtime bar
WarmupIncomplete
17 today
5
RTH window guard
RthGuard
233 today
6
ETH telemetry branch → return
—
opt-in
7a
ORB range established
OrbRangeNotEstablished
OrbReady=True
7b
Two-bar pullback confirmation
OrbRangeNotEstablished
confirmed
7c
Direction filters · AVWAP short veto
GradeFilter
passed
7d
Confluence grade ≥ MinTradeGrade
GradeFilter
GAP-047 suspect
7e
MaxDailyTrades cap
MaxDailyTrades
not hit
8
SIGNAL: written — unconditional, before all risk gates
Four rows share the label KillSwitch (stages 3, 12, 13, 15) and four share GradeFilter (7c, 7d, 14). REJECT SUMMARY aggregates on reason, so its counts are ambiguous. On 2026-08-17 a session logged KillSwitch count=647 from a genuine kill switch; on 08-18 a session logged KillSwitch count=5 from a MaxTradeRisk rejection. Splitting the taxonomy is task P0-C.
3 · Risk validation — four tiers plus the new monitor
A trade must clear every applicable tier. The annotation on Tier 1 is the most consequential correction in v7.0.
TIER 1 — BasicRiskManager
├─ Daily loss P&L ≤ −DailyLossLimit ($1,000) → HALT for the day
├─ Per-trade risk StopTicks × tickValue > MaxTradeRisk ($200) → REJECT
│ ↑ NO QUANTITY TERM. Evaluated BEFORE sizing.
│ ↑ NQ: caps the stop at 40 ticks. MaxStopTicks is 50.
│ ↑ 2026-08-18: rejected 5 signals at $225.00 > $200.00
│ ↑ Real worst case = MaxTradeRisk × MaxContracts = $600
├─ Position count OpenPositions ≥ MaxOpenPositions (3) → REJECT
└─ 80% warning P&L ≤ −$800 → LOG only
TIER 2 — AdvancedRiskManager (weekly + drawdown)
├─ Weekly loss WeeklyPnL ≤ −WeeklyLossLimit → HALT, resets Monday
├─ Trailing DD TrailingDrawdown ≥ DrawdownLimit → HALT until recovery
└─ DD 80% DrawdownPct ≥ 0.8 → LOG alert
TIER 3 — cross-strategy
└─ Cross exposure TotalExposure > MaxCrossStrategyExposure → REJECT
TIER 3.5 — portfolio heat
└─ Heat % (TotalOpenRisk + NewTradeRisk) / Equity × 100 → REJECT if > MaxHeatPct (3.0%)
↑ this tier DOES include quantity — Tier 1 does notTRAILING DRAWDOWN MONITOR — account-keyed, new 2026-08-18
├─ equity = Account.Get(AccountItem.NetLiquidation) ← not yet validated
├─ peak = max(peak, equity)
├─ lock-in if peak ≥ AccountStartingBalance + LockOffset (100) → lock
├─ reference = locked ? lockedPeak : peak
├─ floor = reference − HaltBuffer (2000)
└─ GUARD: EnableTrailingDrawdown=True + AccountStartingBalance=0 → BLOCK ALL ENTRIES↑ 2026-08-18 14:30 onward. 27 rejections. No startup assertion.
4 · Confluence scoring — designed weights vs what actually runs
Each factor calculator emits its designed weight. ConfluenceScorer's constructor pre-populates a weight dictionary with 1.0 for all ten factor types, and ResolveWeight() checks that dictionary first — so the calculators' weights are unreachable dead code. Every STATE: line in production reads x1.00.
Designed weight (from the factor calculators)Actual runtime weight (pre-populated, always 1.00)
The same ten factor scores, both ways — live data, 2026-08-18 10:10:11 ET
Composite — equal weights
0.640
Grade C · what the system logged
Composite — designed weights
0.727
Grade B · one full grade higher
Total weight
10.00 vs 5.85
Context factors carry 50% instead of 14.5%
Grade A reachability
structurally hard
Needs all ten factors ≥ 0.80 average; designed scheme reaches A on factors 1–5 alone
Live factor scores that produced those composites
#
Factor
Score
Designed wt
Actual wt
Reason logged
Grade thresholds: A+ ≥ 0.90 · A ≥ 0.80 · B ≥ 0.70 · C ≥ 0.60 · D below · F at floor. The live gate configuration froze MinTradeGrade = 5 (Grade A); today's workspace runs MinTradeGrade = 4 (Grade B) — itself a drift from the frozen baseline.
5 · Runner economics — why the third contract earns nothing
Revised in rev B — the diagnosis changed. The runner is not badly tuned. Its trailing stop is switched off mid-trade. SetStopLoss() and SetTrailStop() are mutually exclusive per signal name in NinjaScript, and the auto-breakeven block calls SetStopLoss() on the runner signal — replacing a live 12-tick trail with a static stop at entry +1. In 4/4 trades the trail was already 12–16 ticks in profit when breakeven fired and was moved backwards.
AT ENTRY — correct NinjaScript
SetStopLoss (_runnerSignalName, Ticks, intent.StopTicks) initial protective stop
SetTrailStop(_runnerSignalName, Ticks, RunnerTrailTicks=12) ← replaces it with a LIVE 12-tick trail
EnterLong/EnterShort(runnerQty, _runnerSignalName)
IN OnBarUpdate — the defect (NT8StrategyBase.cs ~803)
if (EnableAutoBreakeven && !_breakevenMoved && profitTicks >= 20)
SetStopLoss(_runnerSignalName, Price, entry+1tick) ← DESTROYS THE TRAILWHAT THAT DOES TO THE STOP
entry ──────────────────────────────────────────────────────────────────▶ price
│
├── +12..16t where the live 12-tick trail already sat when breakeven fired
│
├── +1t where SetStopLoss moved it ← 11–15 ticks of locked profit given back
│
├── +24..28t breakeven actually fires here, not at 20 (Calculate = OnBarClose)
│
└── ... trail is gone. Runner sits static until stopped near entry.THE SOURCE COMMENT FOUR LINES BELOW"Do NOT call SetTrailStop here — that resets the trail anchor..."
The author correctly avoided that trap and did not notice that the
SetStopLoss call above it destroys the trail outright.
Trade
Profit when BE fired
Where a 12t trail sat
Where the stop went
Runner gross
Runner net
2026-08-07
+28 t
+16 t
+1 t
$5.00
−$0.76
2026-08-10
+25 t
+13 t
+1 t
$0.00
−$5.76
2026-08-16
+24 t
+12 t
+1 t
$15.00
+$9.24
2026-08-17
+26 t
+14 t
+1 t
$5.00
−$0.76
4 trades
—
55 t = $275
4 t = $20
$25.00
+$1.96
Total net P&L
$1,035.88
4 broker-confirmed trades, after $69.12 commission
Runner share of P&L
0.19%
for 33% of contract exposure
RTH_ORB trades only
3
$758.16 · the 08-16 trade was ETH
Runner net, RTH only
−$7.28
on gate-eligible trades, it loses money
Runner net with a working trail
≈$252
conservative floor: exit at the trail's position when BE fired. It ratchets further, so this is a lower bound
Uplift on realised P&L
≈24%
$1,035.88 → ≈$1,286 · from deleting one call site
Two secondary defects in the same block.entryPrice is Position.AveragePrice — the blended 3-contract average, not the runner's own fill. On 08-16 that produced a breakeven price of 30200.08, which is not a valid NQ price (tick 0.25). And because Calculate = OnBarClose, the 20-tick trigger actually fires at 24–28 ticks.
Consequence for STAGE 2: the RUNNER-001 sweep must not run until this is fixed. An 18-combination sweep over breakeven trigger × trail distance against a runner whose trail is disabled would return a trail axis with no effect and a confident, meaningless recommendation. Fix first (task P2-0), then sweep.
6 · Parameter interaction map
Fourteen interactions between parameters that are individually reasonable. Four are actively broken; two of those are stopping trades today.
7 · Gap register
Colour is severity. GAP-045 through GAP-053 are new in v7.0. Note the numbering caution: GAP-042/043/044 mean the repository's definitions; the July audit findings that v6.4 gave those numbers are renamed HIST-41…46 to make a third collision impossible.
Blocking
Open — high
Open — medium and low
Recently closed
8 · Roadmap v7.0 — critical path
Re-sequenced around three principles: unblock before optimising, fix the measuring instrument before measuring, and treat sample rate as a first-class objective. Stage 3's duration is the whole story.
External command channel (read side can start in Stage 3) · broker-neutral event schema · web + mobile dashboard · additional broker adapters
—
Trades in the last 6 weeks
4
≈0.7 per week
20-trade sample at that rate
≈7 months
This is the binding constraint, not the edge
To first live capital
4–10 mo
optimistic ≈11 weeks
If GAP-047 is the cause
weeks
Fixing the weighting could compress Stage 3 from months to weeks
9 · 2026-08-18 — the day in evidence
Sixteen sessions started. Five valid signals. Zero orders. Two independent blockers, both root-caused, both fixable this week.
06:50 / 07:11
Two strategy instances arm on the same account and instrument (SimSimple ORB / NQ SEP26), both on HFT Algo Bars. Both run until 13:12. single-account doctrine violated
07:11:17
Session header: DaysToLoad=3 on the primary series (configured 120) · WARNING: EnableKillSwitch=False for gate account · factor warm-up SATISFIED, 87 daily bars
09:30 – 10:00
Opening range forms: high 29,769.75, low 29,604.75 — a 165-point range
10:10:11
STATE: Regime=Bearish Direction=Sell Score=0.640 Grade=C — every factor at x1.00. STATE_CONTEXT: OrbReady=True RecommendedContracts=1. The same block reports GapDirectionAlignment="Large gap −523.25 opposes trade" on a Sell — the telemetry path's direction is stale Finding 5
10:10:24.956
SIGNAL: Sell NQ | LIVE MODE — the real intent passed the grade filter
10:10:24.956
REJECT: reason=KillSwitch detail=Risk manager rejected: Trade risk too high: $225.00 45-tick ATR stop × $5.00 = $225.00 > MaxTradeRisk $200.00. MinContracts=1 is already the floor; there is nothing to reduce. Blocker A
10:10:25 → 10:10:46
Four more SIGNAL: Sell NQ lines. All rejected. REJECT SUMMARY: reason=KillSwitch count=5
13:19 – 14:23
Five more sessions started across five different bar periods — HFT Algo, 5 Minute, 15 Minute, 30 Minute, 13 Minute. Nine distinct ConfigHash values and three distinct CodeVersion MVIDs on the day config freeze not in force
14:30:00.133
REJECT: reason=TrailingDrawdownBreach detail=EnableTrailingDrawdown=True but AccountStartingBalance is not configured The monitor added today (DEC-20260818-17) correctly refuses to run without a floor — and its refusal blocks every entry for the rest of the session. 27 rejections. Blocker B
What this day proves. The strategy found a textbook setup — a clean 165-point opening range, a confirmed breakout, a bearish regime, and 4.1× average breakout volume — and could not act on it, twice, for two reasons that have nothing to do with the trading hypothesis. That is the whole argument for Stage 0.
10 · The 24×5 session clock
24×5 coverage is concurrent strategy instances with disjoint session windows, not switching between strategies — settled in architecture.md on 2026-08-17. PortfolioRiskManager was already built for it. A new strategy is a new IStrategy plus a thin NinjaScript subclass; the shared base is not forked. The roadmap names four strategies. It has never had a clock. Here it is.
03:00
LondonORBNT8 — 03:00–03:30 ET opening range
Sprint 4 · named only
no design
09:30
SimpleORBNT8 — 09:30–10:00 ET opening range
under validation
the one that exists
11:00
VWAPMeanReversion — 11:00–14:00 ET
Sprint 4 · named only
no design
15:00
unassigned — closing drive / second RTH ORB
not on the roadmap
gap
18:00
unassigned — Asia-session ORB, the symmetric counterpart to London
GAP-042 — account dimension in PortfolioRiskManager
The singleton is keyed only by strategyId. Fine for several strategies on one account; unsafe across accounts
GAP-055 — MaxDailyTrades persistence
A cap that resets on restart becomes per-strategy-per-restart once several instances run
A portfolio daily loss limit distinct from the sum of per-strategy limits
Three strategies at $1,000 each is a $3,000 day. The hook exists; the number has never been set
Instrument decision (MNQ vs NQ)
Three strategies on NQ at MinContracts=1 is a much blunter instrument than three on MNQ
Assessment: the roadmap covers roughly two thirds of a tradeable 24×5 clock, by name only — no entry hypothesis, no session-window map before this one, no per-strategy design pass. The architecture to support it is genuinely ready and has never been collected. Correctly sequenced behind Stage 5, but the design work is a real outstanding item, not a checkbox.