Repository navigation
security: session-day calendar boundaries + mid-UTC-day tz-offset memo - #160
Merged
Merged
Conversation
Two defects kept FX daily/weekly request.security series wrong while equities looked fine: - Calendar D/W/M keys split at symbol-local midnight; TV forex candles run 17:00-ET -> 17:00-ET (measured 472/472 TV triggers satisfied by the 17:00 session-day cut, zero by local-midnight cuts). Calendar periods now ride the session-day clock; equities coincide with local midnight, so their series are unchanged. - The per-UTC-day tz-offset memo paired the LOCAL midnight with the QUERY instant's UTC floor: any bar whose local date straddles UTC midnight (FX evenings) seeded the whole UTC day with a negative offset, splitting every HTF candle in two with a spurious boundary completion + bogus fragment close. Sample the offset at mid-UTC-day: constant, correct, DST-safe. 24x7 symbols return before the memo (ETH byte-identical); equity RTH bars never straddle a UTC date (values identical). Evidence @ this tree: EURUSD htf-bucket probes D 8.6%->100% (471/471), 240m 76%->100% (1296/1296); population e+s EURUSD 307->327 (+20), AAPL 241->246; ETH scraped 396/396 zero moves; corpus 309/2/1 identical, zero regressions; 133/133 unit tests.
pull Bot
pushed a commit
to Malumbo21/pineforge-engine
that referenced
this pull request
Sep 5, 2026
…kets live; REVIVE-B closes a frozen full leg (round 7 family N, M2) Note log-20260905t112259z-33f32db4. On a bar whose OPEN carries a declined all-in reversal, TradingView's sequence is decline -> brackets dormant -> margin slice -> REVIVE-B, so the position's resting stop is live again for the rest of the bar and fills at its level; at an adverse-extreme cascade a revived, now-marketable bracket closes the remainder AT THE SLICE PRICE on the same bar (finding-311 CASCADE). Two engine gaps: 1. dispatch order. margin_call_slice_at_bar_open runs at the broker-open boundary (engine_run.cpp) BEFORE the order loop declines the reversal (mark_position_brackets_dormant_on_declined_reversal), so the open slice's revive found nothing dormant and the kill then silenced the stop for the bar: algoai 10-30 13:30Z printed 1 @271.96 then 176 @274.11 at the cascade and a next-bar close, where TV (and the no-reversal lab tv tape scratchpad/r7/pins/aapl15-mcopen1-stop-algoai, identical rows) prints 1 @271.96 then 'X' 2814 @273.69 at its level. Now the kill stands down on a bar whose open slice left a survivor (open_margin_slice_bar_): kill + revive net to live. 2. REVIVE-B's marketable check accepted only a deferred default leg (qty NaN, 100%). fast-scalper's 'X' stop was re-issued in position at the 07-18 18:45Z crossunder, so it carried the frozen whole-position qty and was skipped: 268 @214.86 'Margin call' then the remainder next bar @214.68, where TV (pineforge-4pass#160/161) closes 4621 @214.86 on the same bar. A frozen leg that was not a requested partial, or that covers the whole survivor, now cascades too. Control tape aapl15-mcext-stop-scalper-b (no reversal): the stop fills at its level 212.83, no 07-21 slice — unchanged. tests/test_aapl15_margin_brackets.cpp: C. algoai 10-30 (the pin tape + the probe's declined ema9/21 reversal: 76 / 1 @271.96 / 'X' 2814 @273.69), D. fast-scalper 07-21 (268 @214.86 + 'X' 4621 @214.86 same bar, no long). ctest 177/177; no existing expectation moved. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01K8DaPQu4hNi5SZR7r8FhJz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Round 2 of the symbol campaign (follows #159). Two coupled defects kept FX daily/weekly
request.securityseries wrong while equities looked fine.Defect 1 — calendar clock. D/W/M keys split at symbol-local midnight; TV forex candles run 17:00-ET → 17:00-ET (measured: all 472 TV probe triggers satisfied by the session-day cut, zero by any midnight cut — reconstruction in ledger finding 402 follow-ups). Calendar periods now ride the session-day clock. Equities coincide with local midnight, so their series are unchanged.
Defect 2 — tz memo poisoning. The per-UTC-day offset memo paired the local midnight with the query instant's UTC floor. Any bar whose local date straddles UTC midnight (every FX evening bar) seeded the whole UTC day with −20h instead of +4h — splitting every HTF candle in two with a spurious boundary completion and a bogus evening-fragment close. The memo now samples at mid-UTC-day: constant and correct all day, DST-safe (transitions land while session markets are closed).
Evidence @
46d4f64(codegen unchanged at 726a0f4):Known residual (next round): probe-vs-tv on the EURUSD daily probe reports 10 engine-only fills beyond TV's export window edge (window-edge mechanics, not level semantics); weekly FX anchor uses ISO-Monday of the session-day clock vs TV's Sunday-17:00 week start — W probe still divergent, queued.
Symbol-gate PASS · pr-gate PASS (tie carried by trendmatrix MATCH probe, 822/822).