[GAP-060]: reject summary visibility complete

- NT8StrategyBase.cs: made reject summary snapshots ORB-window/date-aware with heartbeat flush

- SimpleORBNT8.cs: bound summary suppression to configured opening range

- tests: added reject summary source guards and SimpleORB no-breakout rejection coverage

- SPRINT_BOARD.md: marked GAP-060 implemented with deploy blocker

- docs/00-governance/decisions.md: recorded DEC-20260823-08 implementation evidence

Build: clean | Tests: 543 passing | Dual-deployed: no - NinjaTrader.exe PID 18800 locked NT8.Core.dll
This commit is contained in:
2026-08-25 10:04:22 -04:00
parent a005deeabf
commit 6c672a5247
7 changed files with 324 additions and 2 deletions

View File

@@ -65,6 +65,10 @@
- The dashboard's headline Score/Grade is therefore not the trade's. Also degrades the GAP-047 study.
- Prompt: `TASK_GAP049_TELEMETRY_DIRECTION_PROMPT.md`. Telemetry now clones `DailyBarContext`, sets clone-only direction/session-open/volume fields from the synthetic telemetry intent path, and adds `orb_range_ticks` metadata for `OrbRangeVsAtr`. Verification: focused tests 30/30, `verify-build.bat` 538/538, Core Release no-build 449/449, deploy backup `20260823_151931`. Manual NT8 compile and live/SIM STATE_DETAIL spot-check still required. P1-E finding: the cited `-523.25` was a telemetry data-alignment defect, not a real overnight gap; NQ SEP26 daily data showed 2026-08-17 close `30096.00` and 2026-08-18 open `30077.00` (`-19.00`).
**[GAP-060] REJECT SUMMARY snapshot mechanism goes dark for hours, including the entire RTH day** | Stage 1 | ✅ IMPLEMENTED — deploy blocked by running NT8
- Live SIM spot-check 2026-08-23/24: file log shows a ~16-hour `REJECT SUMMARY` blackout (`23:55:01` Aug 23 night → `16:00:00` Aug 24 afternoon), covering the entire 09:30-16:00 ET trading day. Confirmed the 09:30-10:00 "Grade A" telemetry Mo saw is by-design (real order path correctly blocked pre-ORB-close; those are hypothetical default-long diagnostic scores, not real signals) — but the log currently cannot show *why* any bar was rejected for that whole span.
- Root cause: `MaybeWriteRejectSummarySnapshot`'s blanket `TimeOfDay < 10:00 AM` gate suppresses the entire midnight-10am span daily (not just the ORB window); `_orbRejectSummarySnapshotWritten` is a session-lifetime flag that fires once (here, accidentally, during the first night's ETH activity) and never again on a multi-day run; snapshots are only ever reject-triggered with no independent timer.
- Prompt: `TASK_GAP060_REJECT_SUMMARY_VISIBILITY_PROMPT.md`. Implemented as observability-only: suppression is now ORB-window/date-aware, the once-after-ORB flag resets per day, and `OnBarUpdate` checks summary cadence on the live bar heartbeat instead of only inside reject logging. Open question resolved as (a): `SimpleORBStrategy.OnBar()` does record `OrbRangeNotEstablished` before and after ORB close during an RTH no-breakout path; missing visibility was adapter summary reporting, not a distinct SimpleORB defect. Verification: focused tests 8/8, `verify-build.bat` 543/543, Core Release no-build 454/454. Deployment attempted but blocked because NinjaTrader.exe PID 18800 locked `NT8.Core.dll`; commit made per operator instruction without deploy.
### Also raised by the review, not yet prompted
GAP-051 (`MicroUpgradeThreshold` fires every session) · GAP-052 (two hardcoded tick-value tables) ·
GAP-053 (`executive_summary.md` and `roadmap.md` Sprint 3 list present ~12 completed tasks as open) ·

View File

@@ -0,0 +1,147 @@
# TASK: GAP-060 — REJECT SUMMARY snapshot mechanism goes dark for hours at a time, including the entire RTH trading day
# Staged: 2026-08-24, found live during Sim101 SIM session review
# Sprint: Stage 1 — logging/observability only, zero trading-behaviour risk
# Owner: Kilocode
# ─────────────────────────────────────────────────────────────────
## THE DEFECT
`session_20260823_230519.log` (a single continuous SIM session spanning
2026-08-23 23:05 ET through at least 2026-08-24 20:20 ET) shows a total
`REJECT SUMMARY` blackout from `23:55:01` (Aug 23 night) to `16:00:00`
(Aug 24 afternoon) — roughly 16 hours, covering the entire 09:30-10:00 ET
ORB window and the entire RTH trading day:
138:[23:55:01.574] REJECT SUMMARY: reason=RthGuard count=9
(... nothing for ~16 hours ...)
720:[16:00:00.056] REJECT SUMMARY: reason=RthGuard count=124
Mo (the operator) watched several Grade-A `STATE:` telemetry prints scroll
by between 09:30-10:00 ET and reasonably asked why nothing traded — the
file log currently cannot answer that question for any bar in that entire
16-hour span, even though evaluation was clearly ongoing (`STATE:` lines
keep printing with changing scores/grades throughout).
## ROOT CAUSE (traced to source, `NT8StrategyBase.cs`)
Three compounding issues in `MaybeWriteRejectSummarySnapshot`/
`LogRejectRateLimited` (~1444-1496):
1. **Blanket time-of-day gate, not ORB-window-aware:**
`if (barTime.TimeOfDay < new TimeSpan(10, 0, 0)) return;`
This is clearly intended to avoid noisy snapshot spam while the 09:30-10:00
ORB range is still forming, but as written it suppresses ANY snapshot
write for ANY bar between midnight and 10:00 AM — including hours of
unrelated overnight ETH activity that have nothing to do with the ORB
window.
2. **`_orbRejectSummarySnapshotWritten` is a session-lifetime flag, not a
per-trading-day flag.** It is only ever reset in `ResetRejectTracking()`,
which is only called once, from `WriteSessionHeader()`, which itself only
runs once per strategy enable (`State.DataLoaded`). On a multi-day
continuous SIM/live run (as tonight's was), this flag gets set `true` the
*first* time any post-10:00-AM-time-of-day reject fires for the entire
run — here that happened to be `23:10:00` on the very first night, since
`23:10 >= 10:00` is also true in a bare `TimeSpan.TimeOfDay` comparison.
After that one-time trigger, the "due after ORB window" path can never
fire again for the rest of the multi-day session — confirmed by the log:
the very first `REJECT SUMMARY` at `23:10:00` sets it, and it stays
`true` from then on.
3. **The snapshot is only ever written as a side effect of some other
reject occurring** — `LogRejectRateLimited` is the sole caller of
`MaybeWriteRejectSummarySnapshot`; there is no independent timer. If the
strategy goes a stretch of the trading day without any *tracked* reject
firing (or if a tracked reject fires but does not itself get logged for
some other reason — see OPEN QUESTION below), the 15-minute interval
target (`REJECT_SUMMARY_SNAPSHOT_INTERVAL_MINUTES = 15`) is never
actually checked, because nothing calls into the function to check it.
Net effect, confirmed directly in tonight's log: zero `REJECT SUMMARY` and
zero individual `REJECT:` lines for the entire 09:30-16:00 ET trading day,
despite `STATE:` telemetry clearly showing ongoing evaluation the whole
time (Grade cycling B→C→D→F as the day progressed). The reject counters
may be accumulating correctly in memory — there is currently no way to
tell from the file log.
## OPEN QUESTION — flag, do not silently resolve
The one snapshot we do have from the trading day (`16:00:00`) shows
`RthGuard count=124` and `WarmupIncomplete count=1` — but **no
`OrbRangeNotEstablished` entry at all**, despite `SimpleORBStrategy.OnBar()`
(`~419-432` and `~600`) recording that exact reason both while the ORB
window is still building (09:30-10:00) and whenever no breakout has yet
confirmed (which per Mo's report was true all day — "never broke out").
Two possibilities, and the task should determine which (do not guess):
(a) The count is genuinely zero because `_rejectCounts` doesn't carry
over correctly across the visibility blackout described above (i.e.
another symptom of the same defect — the accumulation itself is fine,
only the reporting is broken), or
(b) `RecordSignalRejection(context, "OrbRangeNotEstablished", ...)` /
`LogSignalRejectionFromContext(context)` is not actually being reached
for some other reason during RTH bars, which would be a second, distinct
defect beyond snapshot visibility.
Add a temporary diagnostic (or a focused test that drives `OnBar` across a
simulated 09:30-16:00 RTH day with no breakout, then asserts
`_rejectCounts["OrbRangeNotEstablished"]` is non-zero) to settle this
before closing the task. Report which one it was in your writeback.
## THE CHANGE
1. Make ORB-window-aware snapshot suppression **date-aware**, not just
time-of-day: only suppress while `barTime` falls within *today's*
09:30-10:00 window (or whatever the actual configured ORB window is),
not the entire midnight-10:00 span.
2. Make `_orbRejectSummarySnapshotWritten` (or its replacement) reset **per
trading day**, the same way `SimpleORBStrategy` already tracks
`_currentSessionDate` for its own daily reset — reuse that pattern/timing
if practical, so the "due after ORB window" trigger can fire once per
day, every day, on a long-running session.
3. Add an independent, timer-driven flush path so a full trading day cannot
go dark even if no reject happens to occur at the right moment to trigger
one — e.g. check-and-flush from the regular `OnBarUpdate` heartbeat
(every processed RTH bar, or every N minutes) rather than solely as a
side effect of `LogRejectRateLimited`. Keep the existing 15-minute
interval as the cadence target.
4. Resolve the OPEN QUESTION above and report the answer.
## DO NOT
- Do not change `RecordSignalRejection`'s reason strings or any actual
order-flow/risk/sizing logic — this task is about getting existing reject
data to the file log reliably, not changing what gets rejected or why.
- Do not remove the existing rate-limiting behavior for the one-time detail
line per reason (`_rejectDetailsLogged`) — that part is working as
intended and is not in scope.
- Do not change `REJECT_SUMMARY_SNAPSHOT_INTERVAL_MINUTES` (15) unless you
find a concrete reason to, and if so, say why in your writeback.
## TESTS (required)
1. A test simulating bars from before midnight through past the next day's
10:00 AM ORB close, asserting a `REJECT SUMMARY` snapshot is written at
(or shortly after) 10:00 AM on the new day even though one already fired
the prior evening — this is the exact regression that would have caught
tonight's blackout.
2. A test simulating a full RTH day with periodic rejects (or none) and
confirming a snapshot is written at least once per ~15 minutes via the
new timer-driven path, not solely reject-triggered.
3. Whatever test resolves the OPEN QUESTION above.
## VALIDATION (operator)
After the next SIM session spanning a full trading day, confirm
`REJECT SUMMARY` lines appear at a reasonable cadence throughout 09:30-16:00
ET (not just at session start and session end), and that `SPRINT_BOARD.md`'s
next live-session check explicitly looks for this.
## GOVERNANCE
Track as [GAP-060] in SPRINT_BOARD.md. Update `docs/00-governance/decisions.md`
DEC-20260823-08 status to `implemented` with an implementation note stating
which of the OPEN QUESTION possibilities (a) or (b) was confirmed, and how.
Reference: this task, DEC-20260823-08, `session_20260823_230519.log`.

View File

@@ -13,6 +13,17 @@ Use this file to record durable project decisions that affect implementation pat
## Decision Log
### DEC-20260823-08
- **ID:** DEC-20260823-08
- **Date:** 2026-08-24
- **Status:** implemented
- **Context:** Mo reported watching several Grade-A `STATE:` telemetry prints between 09:30-10:00 ET and asked why nothing traded — specifically noting these appeared to be "rejected because it wasn't 10AM yet." Investigated `session_20260823_230519.log` directly (continuous session, 2026-08-23 23:05 ET through 2026-08-24 20:20+ ET).
- **Finding 1 (not a defect — confirms by-design behavior):** The 09:30-10:00 ET rejection is intentional and correct. `SimpleORBStrategy.OnBar()` (`~419-432`) unconditionally rejects with reason `OrbRangeNotEstablished` ("ORB window still building") for any bar before the configured ORB window closes — an ORB strategy cannot evaluate a breakout of a range that hasn't finished forming. Confirmed the Grade-A `STATE:` lines Mo saw in that window are a *separate*, always-on diagnostic telemetry stream (`MaybeWriteStateTelemetry`) that scores a hypothetical default-long intent (`DirectionSource=DefaultLong`, not `OpeningRangeMidpoint`) purely for dashboard visibility — confirmed via the log itself: `STATE_CONTEXT` omits `OrbHigh`/`OrbLow`/`OrbWindowStart`/`OrbWindowEnd`/`OrbReady` entirely before 10:00 ET, and only starts including them at `10:04:59` once the real ORB range exists. Nothing tradeable was missed; the real order-eligibility path was correctly blocked the whole time.
- **Finding 2 (real defect — logged as GAP-060):** While confirming Finding 1, discovered the file log has **zero visibility into reject reasons for the entire 09:30-16:00 ET trading day** — a ~16-hour `REJECT SUMMARY` blackout from `23:55:01` (Aug 23 night) to `16:00:00` (Aug 24 afternoon), spanning exactly the window Mo was asking about. Root cause traced to `MaybeWriteRejectSummarySnapshot`/`LogRejectRateLimited` (`NT8StrategyBase.cs` ~1444-1496): (1) a blanket `barTime.TimeOfDay < 10:00 AM` suppression gate that blocks snapshots for the whole midnight-10am span every day, not just the ORB-forming window; (2) `_orbRejectSummarySnapshotWritten` is a session-lifetime flag (reset only once, at `WriteSessionHeader()`), so on a multi-day continuous run it fires once — here, accidentally, during the first night's ETH activity at `23:10:00` — and then never again; (3) snapshots are only ever written as a side effect of some other reject occurring, with no independent timer, so a quiet stretch of the trading day goes dark even past the intended 15-minute cadence. Left open and flagged (not resolved) whether `OrbRangeNotEstablished` itself is even being counted during this window, since the one snapshot we do have (`16:00:00`) shows zero for that reason despite a full day with no confirmed breakout — the task must determine whether that's the same visibility defect or a second, distinct one.
- **Decision:** Track as **GAP-060**. Logging/observability only — no order-flow, sizing, or risk logic involved. This directly explains why tonight's session couldn't answer "why didn't it trade" from the file log, and is a higher operational priority than GAP-059/051/052 (already queued) since it blocks diagnosing any future no-trade day, not just one telemetry factor.
- **Related Files:** `src/NT8.Adapters/Strategies/NT8StrategyBase.cs` (`MaybeWriteRejectSummarySnapshot`/`LogRejectRateLimited`/`ResetRejectTracking`/`WriteSessionHeader` ~1444-1517), `src/NT8.Strategies/Examples/SimpleORBStrategy.cs` (`OnBar` ~355-432, `RecordSignalRejection` ~1015-1026), `session_20260823_230519.log`
- **Implementation Note (2026-08-25):** GAP-060 implemented as logging/observability only. `NT8StrategyBase.MaybeWriteRejectSummarySnapshot()` no longer has a blanket midnight-to-10:00 AM suppression gate; suppression now delegates to an ORB-window-aware helper and `SimpleORBNT8` overrides that helper so the suppressed window is today's configured 09:30 + `OpeningRangeMinutes`. The once-after-ORB snapshot flag now resets per `barTime.Date`, allowing a new post-ORB summary every day in a continuous multi-day session. `OnBarUpdate()` now calls `MaybeWriteRejectSummarySnapshot(Time[0])` on the live bar heartbeat after the first realtime-bar guard, so 15-minute summary cadence can flush from regular processed bars and is not solely dependent on a newly logged reject. Existing `_rejectDetailsLogged` one-detail-line-per-reason rate limiting, reject reason strings, `REJECT:`/`REJECT SUMMARY:` formats, order flow, sizing, risk, and real trade decisions were unchanged. Open question resolved as possibility **(a)**: the missing `OrbRangeNotEstablished` visibility was adapter summary reporting, not a second SimpleORB rejection defect. A focused `SimpleORBStrategy.OnBar()` test proves the no-breakout RTH path records `OrbRangeNotEstablished` both while the ORB is building and after ORB close when no breakout confirms. Verification: focused GAP-060 tests passed 8/8; `verify-build.bat` passed with 543/543 tests (454 Core, 79 Integration, 10 Performance); `dotnet test tests\NT8.Core.Tests\NT8.Core.Tests.csproj --configuration Release --no-build --verbosity minimal` passed 454/454.
- **Action Required:** Deployment remains pending. `deployment\deploy-to-nt8.bat` was attempted on 2026-08-25 but failed because NinjaTrader.exe PID 18800 locked `NT8.Core.dll`; operator instructed Kilocode to commit without deploy. After NinjaTrader is closed, rerun deployment, start NT8, manually compile NinjaScript, and in the next SIM session spanning a full trading day confirm `REJECT SUMMARY` appears throughout RTH at a reasonable cadence.
### DEC-20260823-03
- **ID:** DEC-20260823-03
- **Date:** 2026-08-23

View File

@@ -152,6 +152,7 @@ namespace NinjaTrader.NinjaScript.Strategies
private int _lastStateTelemetryPendingBreakoutDirection;
private bool _lastStateTelemetryGradeMeetsThreshold;
private bool _orbRejectSummarySnapshotWritten;
private DateTime _rejectSummarySnapshotTradingDate = DateTime.MinValue;
private bool _microUpgradeSuggested;
private bool _trailingDrawdownHalted;
private string _trailingDrawdownAccountName;
@@ -704,6 +705,8 @@ namespace NinjaTrader.NinjaScript.Strategies
return;
}
MaybeWriteRejectSummarySnapshot(Time[0]);
// Sync actual open position to portfolio manager on every bar
PortfolioRiskManager.Instance.UpdateOpenContracts(Name, Math.Abs(Position.Quantity));
@@ -1473,9 +1476,16 @@ namespace NinjaTrader.NinjaScript.Strategies
if (_rejectCounts.Count == 0)
return;
if (barTime.TimeOfDay < new TimeSpan(10, 0, 0))
if (IsRejectSummarySnapshotSuppressed(barTime))
return;
DateTime tradingDate = barTime.Date;
if (_rejectSummarySnapshotTradingDate != tradingDate)
{
_rejectSummarySnapshotTradingDate = tradingDate;
_orbRejectSummarySnapshotWritten = false;
}
bool dueAfterOrbWindow = !_orbRejectSummarySnapshotWritten;
bool dueInterval = _lastRejectSummarySnapshotTime != DateTime.MinValue
&& (barTime - _lastRejectSummarySnapshotTime).TotalMinutes >= REJECT_SUMMARY_SNAPSHOT_INTERVAL_MINUTES;
@@ -1488,12 +1498,30 @@ namespace NinjaTrader.NinjaScript.Strategies
_orbRejectSummarySnapshotWritten = true;
}
private bool IsRejectSummarySnapshotSuppressed(DateTime barTime)
{
DateTime suppressionStart;
DateTime suppressionEnd;
if (!TryGetRejectSummarySnapshotSuppressionWindow(barTime, out suppressionStart, out suppressionEnd))
return false;
return barTime >= suppressionStart && barTime < suppressionEnd;
}
protected virtual bool TryGetRejectSummarySnapshotSuppressionWindow(DateTime barTime, out DateTime suppressionStart, out DateTime suppressionEnd)
{
suppressionStart = barTime.Date.AddHours(9.5);
suppressionEnd = barTime.Date.AddHours(10.0);
return true;
}
private void ResetRejectTracking()
{
_rejectCounts.Clear();
_rejectDetailsLogged.Clear();
_lastRejectSummarySnapshotTime = DateTime.MinValue;
_orbRejectSummarySnapshotWritten = false;
_rejectSummarySnapshotTradingDate = DateTime.MinValue;
}
private void WriteSessionHeader()

View File

@@ -320,6 +320,13 @@ namespace NinjaTrader.NinjaScript.Strategies
return sdkOrb.PendingBreakoutDirection;
}
protected override bool TryGetRejectSummarySnapshotSuppressionWindow(DateTime barTime, out DateTime suppressionStart, out DateTime suppressionEnd)
{
suppressionStart = barTime.Date.AddHours(9.5);
suppressionEnd = suppressionStart.AddMinutes(OpeningRangeMinutes);
return OpeningRangeMinutes > 0;
}
/// <summary>
/// Adds Simple ORB status lines to the shared top-left diagnostics block.
/// </summary>

View File

@@ -0,0 +1,94 @@
using System;
using System.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace NT8.Core.Tests.Adapters
{
[TestClass]
public class NT8StrategyBaseRejectSummaryTests
{
[TestMethod]
public void MaybeWriteRejectSummarySnapshot_IsNotSuppressedByBlanketMidnightToTenGate()
{
string source = File.ReadAllText(FindSourceFile("NT8StrategyBase.cs"));
string method = ExtractMethodBlock(source, "private void MaybeWriteRejectSummarySnapshot");
Assert.IsFalse(method.Contains("barTime.TimeOfDay < new TimeSpan(10, 0, 0)"), "Reject summaries must not suppress the whole midnight-to-10am span.");
Assert.IsTrue(method.Contains("IsRejectSummarySnapshotSuppressed(barTime)"), "Reject summary suppression must be ORB-window-aware.");
}
[TestMethod]
public void MaybeWriteRejectSummarySnapshot_ResetsAfterOrbTriggerPerTradingDate()
{
string source = File.ReadAllText(FindSourceFile("NT8StrategyBase.cs"));
string method = ExtractMethodBlock(source, "private void MaybeWriteRejectSummarySnapshot");
Assert.IsTrue(source.Contains("private DateTime _rejectSummarySnapshotTradingDate = DateTime.MinValue;"), "Reject summary once-after-ORB tracking must have a date key.");
Assert.IsTrue(method.Contains("DateTime tradingDate = barTime.Date;"), "Reject summary tracking must derive a date from each bar.");
Assert.IsTrue(method.Contains("_rejectSummarySnapshotTradingDate != tradingDate"), "Reject summary tracking must detect day changes.");
Assert.IsTrue(method.Contains("_orbRejectSummarySnapshotWritten = false;"), "The once-after-ORB flag must reset on a new day.");
}
[TestMethod]
public void OnBarUpdate_ChecksRejectSummarySnapshotOnHeartbeat()
{
string source = File.ReadAllText(FindSourceFile("NT8StrategyBase.cs"));
string method = ExtractMethodBlock(source, "protected override void OnBarUpdate");
Assert.IsTrue(method.Contains("MaybeWriteRejectSummarySnapshot(Time[0]);"), "OnBarUpdate must check summary flush cadence independently of new rejects.");
Assert.IsTrue(method.IndexOf("MaybeWriteRejectSummarySnapshot(Time[0]);", StringComparison.Ordinal) < method.IndexOf("BuildStrategyContext()", StringComparison.Ordinal), "Heartbeat flush must not depend on a strategy-generated rejection.");
}
[TestMethod]
public void SimpleORB_RejectSummarySuppressionWindow_UsesConfiguredOpeningRangeMinutes()
{
string source = File.ReadAllText(FindSourceFile("SimpleORBNT8.cs"));
string method = ExtractMethodBlock(source, "protected override bool TryGetRejectSummarySnapshotSuppressionWindow");
Assert.IsTrue(method.Contains("suppressionStart = barTime.Date.AddHours(9.5);"), "SimpleORB suppression must be anchored to today's RTH ORB start.");
Assert.IsTrue(method.Contains("suppressionEnd = suppressionStart.AddMinutes(OpeningRangeMinutes);"), "SimpleORB suppression must use the configured ORB length.");
Assert.IsTrue(method.Contains("return OpeningRangeMinutes > 0;"), "SimpleORB suppression must be disabled for invalid ORB lengths.");
}
private static string FindSourceFile(string fileName)
{
DirectoryInfo dir = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory);
while (dir != null)
{
string candidate = Path.Combine(dir.FullName, "src", "NT8.Adapters", "Strategies", fileName);
if (File.Exists(candidate))
return candidate;
dir = dir.Parent;
}
throw new FileNotFoundException("Could not locate src\\NT8.Adapters\\Strategies\\" + fileName + " from test output directory.");
}
private static string ExtractMethodBlock(string source, string signature)
{
int start = source.IndexOf(signature, StringComparison.Ordinal);
if (start < 0)
Assert.Fail("Source does not contain method: " + signature);
int brace = source.IndexOf("{", start, StringComparison.Ordinal);
if (brace < 0)
Assert.Fail("Method has no opening brace: " + signature);
int depth = 0;
for (int i = brace; i < source.Length; i++)
{
if (source[i] == '{')
depth++;
else if (source[i] == '}')
{
depth--;
if (depth == 0)
return source.Substring(start, i - start + 1);
}
}
Assert.Fail("Method has no closing brace: " + signature);
return string.Empty;
}
}
}

View File

@@ -76,7 +76,38 @@ namespace NT8.Core.Tests.Strategies
regimeLine.Replace("reason=RegimeVeto", "reason={reason}"));
}
[TestMethod]
public void OnBar_RthNoBreakout_RecordsOrbRangeNotEstablishedBeforeAndAfterOrbClose()
{
SimpleORBStrategy strategy = CreateStrategy((int)TradeGrade.F, false);
DateTime sessionStart = DateTime.Today.AddHours(9.5);
StrategyContext buildingContext = CreateContext(sessionStart);
BarData buildingBar = new BarData("NQ", sessionStart.AddMinutes(5), 19000, 19010, 18990, 19000, 1500, TimeSpan.FromMinutes(5));
StrategyIntent buildingIntent = strategy.OnBar(buildingBar, buildingContext);
Assert.IsNull(buildingIntent);
Assert.IsTrue(buildingContext.CustomData.ContainsKey("signal_reject_reason"));
Assert.AreEqual("OrbRangeNotEstablished", buildingContext.CustomData["signal_reject_reason"]);
StrategyContext afterCloseContext = CreateContext(sessionStart);
BarData afterCloseBar = new BarData("NQ", sessionStart.AddMinutes(35), 19000, 19008, 18992, 19000, 1500, TimeSpan.FromMinutes(5));
StrategyIntent afterCloseIntent = strategy.OnBar(afterCloseBar, afterCloseContext);
Assert.IsNull(afterCloseIntent);
Assert.IsTrue(afterCloseContext.CustomData.ContainsKey("signal_reject_reason"));
Assert.AreEqual("OrbRangeNotEstablished", afterCloseContext.CustomData["signal_reject_reason"]);
Assert.IsTrue(afterCloseContext.CustomData["signal_reject_detail"].ToString().Contains("No confirmed breakout"));
}
private static SimpleORBStrategy CreateStrategy(int minTradeGrade)
{
return CreateStrategy(minTradeGrade, true);
}
private static SimpleORBStrategy CreateStrategy(int minTradeGrade, bool testMode)
{
SimpleORBStrategy strategy = new SimpleORBStrategy(30, 1.0);
StrategyConfig config = new StrategyConfig(
@@ -85,7 +116,7 @@ namespace NT8.Core.Tests.Strategies
new Dictionary<string, object>(),
new RiskConfig(1000.0, 200.0, 2, false),
new SizingConfig(SizingMethod.FixedDollarRisk, 1, 3, 100.0, null));
config.Parameters.Add("TestMode", true);
config.Parameters.Add("TestMode", testMode);
config.Parameters.Add("MaxDailyTrades", 1);
config.Parameters.Add("StopTicks", 8);
config.Parameters.Add("TargetTicks", 16);