Skip to content

Commit 35db01c

Browse files
luisleo526claude
andauthored
XAU-CAL: daily bars dated by the daily feed, the daily magnifier, and TradingView's session calendar (#298)
* XAU-CAL: a daily bar the installed daily feed dates is labelled by its stamp OANDA stamps its XAUUSD daily bars at 17:00 ET, in the break of the 1800-1700 session. TradingView dates every daily bar and every order of OANDA:XAUUSD 1D by that stamp -- 22:00 UTC in EST, 21:00 UTC in EDT -- also when the chart is backtested with the bar magnifier on its 60-minute intrabars (lab tv --no-note, the lane's synthetic xc-dmag-xau1d and xc-dmag-dip-xau1d with their -off twins, OANDA:XAUUSD 1D 2026-02-16 .. 04-01; the entry comments spell time 0216-2200 / 0308-2100 and time_close the next stamp). A run that aggregates an intraday input into "D" script bars resolved each bar's calendar interval from the session and labelled it at the session's 18:00 ET open (script_interval_resolved), an hour after TradingView's date: probe bystry1991 xauusd-1d, run magnified, books TradingView's one trade on the 2026-03-23 bar at 22:00 UTC, outside the tape's window (lane TAIL-C, BLOCKED 1). Mechanism, NativeExecutionConsumer::prepare_day_labels (kernel, src/native_execution_consumer.cpp), prepared at the end of begin_ready, once every feed the run reads is installed, and read where a script interval resolves: - with an intraday input, a "D" script timeframe and a daily feed installed -- the feed store's (set_native_security_feed) or a declared series' authoritative bars -- each stamp labels the D bar holding the session instant it covers: the stamp itself inside a session, else the next session's open (the instant the store already keys the feed's bars by); - only the label moves: the bar's span, closes, successor and OHLCV stay the calendar's aggregate, and a lookup by the label is the bar's own (day_label_origin): the bar's open and close, its input slot, its sub-bars on a magnified run, its execution anchors and risk day read the bar's interval and day, not the day before the stamp; a C host's session_day_ordinal is read at the bar's first in-session instant (native_c_host.cpp, the pf_native_decision_v1 field's doc says so); - a bar no stamp covers keeps the calendar's label, a bar two stamps cover takes the earlier, and a label never passes an input bar the run holds: a stamp with an input between it and its bar's calendar open labels nothing (a label never follows its bar's first input, nor precedes an input of the bar before; NSE's 13:45 Muhurat stamp opens its day and labels it); - no daily feed, a calendar or raw-label input, or a script timeframe other than one day: no label moves and no calendar lookup is made. A stamp at the calendar's own open (09:30 ET, 17:00 CT, 00:00 UTC, OANDA:EURUSD's 17:00 ET) changes nothing. ADR-0001 (rule 2), new section "Lane XAU-CAL: rule 2 ruling": - generic: a venue dates its own days; a second venue is driven by installing its own daily bars, and the kernel holds no venue's day-stamp convention and branches on no platform; - no knob: the policy knob is the authoritative-feed ruling's, installing the daily feed or not, as W15's late opens are; a day-label field would restate the stamps the run installed. docs/pages/native-engine.md lists the rule with the feed store's others. Consistency with lane TAIL-G (r5/tail-g bded86be, on main since INT30): its adapter reads another symbol's bars on a D chart by the chart bar's own time and time_close. On the magnified daily route the chart bar the adapter sees (on_native_bar_open's script bar, time) is now the stamp and its time_close the next stamp -- the two values the chart-feed route gives -- so both routes read the same foreign bars. Tests: tests/test_native_day_labels.cpp (kernel-only): OANDA's break stamps across the 2026-03-08 DST switch (labels = stamps, spans, closes and values unchanged; the bar's open reads the interval and input slot its close does), a magnified run (every sub-bar the bar's own, 23 hourly), a declared series' authoritative D bars, OANDA:EURUSD's 1700-1700 stamps at the open (nothing moves), a missing, a doubled and a post-input stamp, an input in the break before a stamp's bar (FeedTolerant), NSE's late open, a daily input, a weekly and an intraday script, a reused host. Fail-before (compiled against main 0411892): "558 checks, 131 failures", the first "[break stamps] dated.bars[i].label == w.stamps[i]". After: "558 checks, 0 failures". tests/test_native_c_api.c, check_decision_session_day_of_a_dated_bar: a C host's dated bar reads its stamp as its label and interval open, the session's open as its first eligible instant, and the session's trading date as its session day; against 0411892 4 failures ("a dated day's bar is not labelled by its stamp"), after: ok. Review (read-only, opus): the first cut relabelled the interval but a lookup by the moved label resolved the day before the stamp -- the bar-open hook, a magnified run's close, execution anchors and risk frames read the previous day's interval and input slot, a C host the previous trading date, the magnifier walked sub-bars from the stamp, and an input in the break before a stamp could precede the label; the Pine adapter reads the label, so no trade moved. Against the first cut the extended tests fail "558 checks, 102 failures" and 2 (the C host's day). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * XAU-CAL: a daily chart that declares the bar magnifier runs magnified where the finer feed rebuilds its own daily bars TradingView backtests a daily chart that declares use_bar_magnifier = true on its 60-minute intrabars (lab tv --no-note, the lane's synthetic xc-dmag-dip-xau1d: 20 trades; the same script declared off, xc-dmag-dip-off-xau1d: 18 -- the order of a day's extremes decides 2 of them). scripts/run_strategy.py refused the magnifier on a daily chart ("chart 1D is daily or coarser", _declared_magnifier_plan), so bystry1991-ema200-regime-bos-choch-2x-fvg-strategy on OANDA:XAUUSD 1D walked its 2026-03-23 bar O -> L -> H -> C and took a next-bar stop-loss where TradingView's hourly path enters at 23:15 and takes its +100 target at 00:39 (lane TAIL-C, BLOCKED 1): moderate, pnl p90 150 %. The harness (_declared_magnifier_plan, _daily_bars_rebuilt, scripts/run_strategy.py): - a daily chart runs on the lane's finer feed like an intraday one: input_tf 1, script_tf the chart's, the magnifier on, bounded by the chart's own span (its first stamp to its last bar's end); - the chart keeps its own daily bars. The finer feed must rebuild every one of them: over each bar's span, stamp to stamp, its first open, extremes, last close and summed volume are the bar's. OANDA:XAUUSD, OANDA:EURUSD and BINANCE:BTCUSDT's lanes do on every bar; NSE, NYSE, NASDAQ (official open and close), CME (settlement; a finer feed from 2023-08) and BINANCE:ETHUSDT.P (4 opens, 147 volumes) do not, and their charts run as they did, the plan saying which bar and field it missed; - the chart feed is installed as the run's daily feed (native_security_feeds), whose stamps date the days (the kernel's day-label rule, previous commit), unless the run installs one already; - both lane feeds end at TradingView's range end, inside the chart's last bar. The feed's part of that bar must open at its open and stay inside its extremes, and the bar is completed from the chart bar -- one input at its last minute carrying the rest of it (Strategy.run's ohlcv_tail_bar, _with_tail_bar) -- so it is calculated as the chart run's last bar is and a position still open closes at its close, as TradingView's does. A feed that stops before the last bar's first minute, or inside a chart of one bar, does not rebuild it (the magnified run would end a day short); an empty feed rebuilds nothing; float-spelled stamps read as the loader reads them; a chart spelled 1440 (inferred from its bars) runs as 1D; - weekly, monthly and multi-day charts stay declared-not-run. Tapes: tests/fixtures/daily_magnifier (four lab tv --no-note exports and the bars they replay on: the lane's daily feed and its 1m feed aggregated on the hour). tests/test_daily_magnifier_tapes.cpp replays them through the Pine adapter: magnified with the daily feed 20/20 and 31/31, the -off twins on the daily bars 18/18 and 31/31 -- entry and exit bar and price and the entry comment's time / time_close; without the daily feed every magnified trade is an hour late. Fail-before (against main 0411892's library): "27 checks, 2 failures" (0 of 20 and 0 of 31, every one an hour late). After: "27 checks, 0 failures". scripts/test_run_strategy_magnifier.py: the daily plan (1m feed, bounds, the chart as the daily feed, an installed daily feed kept), the four ways a feed does not rebuild a chart, the three ways it cannot complete the last bar, an empty feed, float stamps, a 1440 chart, the cut last bar's completion, the tail bar, and weekly / monthly / multi-day refusals. Against 0411892 the module fails at import (no _with_tail_bar); against the first cut (review, read-only opus) the four new tests fail (4 failures, 2 errors). After: 20 passed. Lane replica (the pinned lab 16e3f228 verifier, lane templates' env and feeds, this change on 7239ab3, codegen main 90bfa0b), every daily probe that declares the magnifier: xauusd-1d bystry1991 moderate (pnl p90 150) -> excellent 1/1, magnified btcusdt-1d bystry1991 excellent -> excellent, magnified btcusdt-1d job-1361 excellent -> excellent 8/8, magnified, last bar completed eurusd-1d job-1361 excellent -> excellent 2/2, magnified, last bar completed ethusdtp-1d x2, es1-1d, nq1-1d x2, nifty-1d x2, f-1d: excellent, declared-not-run Without the rebuild check and the completion, job-1361 fell to weak / strong / moderate on es1 / eurusd / btc / f and bystry1991 and job-1361 to minimal on nifty-1d (official opens, settlement closes, a short finer feed, a range end one bar early). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * XAU-CAL: the Pine host reads the bar after the current one from TradingView's calendar for the symbol, where the run holds it TradingView reads the bar after the current one from its calendar for the chart's symbol, not from the chart's bars: time("", "", -1), time_close("", -1), time("", -2), time("D", 0, -1), a timeframe's bar stepped back (time("60", 0, 1)), session.islastbar and session.islastbar_regular (lab tv --no-note, the lane's synthetic xc-flags-* tapes; the first bar of a day stays the chart's). OANDA:XAUUSD's calendar is a session every weekday from 17:00 ET to 17:00 ET, holidays included; its feed has no bar from 17:00 to 18:00 ET, none on Good Friday, Christmas or New Year's Day, and stops early on US holidays -- so on job-2660-pinecoderstasc-tasc-2026-06-one-percent-a- week-adaptive, which closes at session.islastbar_regular when the next bar's weekday is lower and enters when it is Monday, the engine's feed reading parted from TradingView in every holiday week: xauusd-15 moderate 56/48, xauusd-1d strong 56/54 (lane TAIL-E, BLOCKED). NASDAQ:AAPL's, NYSE:F's and NSE:NIFTY's calendars carry their exchanges' holidays and early closes, and their lanes' feeds hold exactly those sessions (xc-cal-aapl15 / -f15 / -nifty15 over 2025-04 .. 2026-05: no day, open or close parts). The calendar becomes a pinned run input (TradingView's own, captured): - scripts/symbol_calendar.py makes a pineforge-symbol-calendar/v1 document (per session day [open_ms, close_ms], and the tape's provenance) from a lab tv tape of the lane's synthetic xc-symbol-calendar probe, whose first bar of every day spells that day's time("D") / time_close("D") and the next three days'. tests/fixtures/symbol_calendar holds OANDA:XAUUSD's and OANDA:EURUSD's (2021-05 .. 2026-05, 1308 days each) and the AAPL, F and NIFTY controls; - scripts/run_strategy.py: where the case runner names one (PINEFORGE_RUN_SESSION_CALENDAR, held to PINEFORGE_RUN_SESSION_CALENDAR_SHA256), the calendar of the run's symbol travels as syminfo metadata ("symbol_calendar_days", "symbol_calendar_open:<i>", "_close:<i>") -- the channel the harness's other adapter inputs use, so no C-ABI export or kernel file changes; another symbol's calendar is refused, and the run's fingerprint names it (runtime.session_calendar: its day count and the sha256 of its days); - the Pine host (PineStrategyHost::set_symbol_calendar, src/source) installs it when the run begins, consuming the days the metadata named (a day the count names but no key carries fails the run naming it, never an earlier run's; a day key whose index is no decimal number is no day; a count that is no number >= 0 removes the calendar) and, inside the calendar's days: a regular intraday bar is session.islastbar(_regular) when the calendar's next slot opens another day (scheduler_update_session_state); pine_time_offset's chart bars ahead on an intraday or 1D chart, a timeframe's bars stepped either way and a day's open and close are the calendar's (symbol_calendar_open_from / _open_before / _day). A W, M or multi-day chart's own bars are no calendar day and read the history. Bars behind stay the history's; outside the calendar and with none installed every reading is the feed's, as before. No kernel call and no state is added. Tapes and tests: tests/test_symbol_calendar_tapes.cpp replays the five OANDA:XAUUSD windows (Good Friday, Memorial Day, Independence Day, Thanksgiving, year end): 18,340 cells, 0 differ with the calendar, 391 with the feed; AAPL's Thanksgiving week 0 differ with its calendar and without; lane TAIL-E's te-time-bb-chart-xau15 / -tf-xau15: 12,144 cells, 0 differ with the calendar, the 484 its test names without; the metadata transport, a missing day's refusal and out-of-order days, the days consumed per run on a reused host, a malformed day key, a count that removes the calendar; W and M charts of 40 bars each read alike with the calendar and without. Fail-before (against main 0411892, which holds TAIL-E's pine_time_offset): "no member named 'set_symbol_calendar'". After: "93 checks, 0 failures". scripts/test_symbol_calendar.py: the fixtures' calendars are their tapes, OANDA's holidays, the 17:00 ET hour and the one correction, the refusals, the metadata, the run fingerprint and inputs_run_kwargs; against 0411892 "No module named 'symbol_calendar'". After: 9 passed. Review (read-only, opus): against the first cut the new host checks fail "93 checks, 8 failures" (W and M: 40 of 40 bars read otherwise) and the fingerprint test KeyError 'session_calendar'. Lane replica (the pinned lab 16e3f228 verifier, lane templates' env and feeds, this change on 7239ab3 with TAIL-E's pine_time_offset, codegen main 90bfa0b with lane TAIL-E's codegen picks, which lower time() with bars_back), job-2660: xauusd-15 moderate 56/48 -> excellent 48/48 (calendar xc-cal-xau15) xauusd-1d strong 56/54 -> excellent 54/54 (the same calendar) eurusd-15, eurusd-1d excellent 56/56 -> excellent 56/56 (xc-cal-eurusd15-full) aapl-15, f-15 the same grade with the calendar and without it Only job-2660 reads these readings in the population (session.islastbar* or time() / time_close() with bars_back: 12 probes, one per lane). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * XAU-CAL: the ctest floors count the lane's rows Floors (scripts/ci_verify.py), each comment naming the rows, on main 0411892 (INT30 and TAIL-I): - KERNEL_MIN_TESTS 298 -> 300: test_native_day_labels (kernel-only) and test_symbol_calendar (a source-free harness suite); - RELEASE_MIN_TESTS 786 -> 790: those two plus the source-bound test_daily_magnifier_tapes and test_symbol_calendar_tapes (TAIL-E's test_time_bars_back_tapes, which the lane picked on 7239ab3, is main's own row since INT30); - EXCLUDED_REGISTERED_MIN debug / sanitizers / native 767 / 767 / 776 -> 771 / 771 / 780, the same four rows in each, and scripts/test_ci_verify.py's pin of it with them. ctest -N on main and on this tree, configured alike, differ by exactly these four rows. Doc anchors are re-anchored once, on the rebased tree, in the next commit. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * XAU-CAL: a C host's session day moves only on a 1D script, a run's begin reads no earlier run's day labels, a calendar that fails to install leaves none, and every doc anchor is re-anchored once A second read-only review (opus, "approve with comments") of the day-label and calendar fixes found: - the C host read every bar's session day at max(script_interval_open_ms, script_interval_eligible_open_ms), which also moved 2D, W and M bars on a masked session whose period opens on a day that does not trade (February 2025 on 0930-1600:23456: nominal Sat 02-01 -> Mon 02-03), an ABI field outside the lane. It now does so only on a 1D script, where only a daily stamp moves a bar's label before its session's open (native_c_host.cpp; the pf_native_decision_v1 doc says so). Witness: tests/test_native_c_api.c check_decision_session_day_of_a_masked_month -- the February bar keeps its nominal open's day; against c7df82e6 (r5/xau-cal-7239^, this code before this commit) "a masked month's day moved to its first session". The check pins main's reading, so it passes on main 0411892, where no label moves. The dated-day check still holds. - a host reused across runs kept the previous run's day labels through the next begin until prepare_day_labels ran at its end; they are cleared where the begin clears its interval cache (prepare_public_begin). - deliver_tick read a print's input slot at its raw stamp while its script interval went through day_label_origin; both read the bar's own now. - a calendar announcement that fails to install (a day missing) left the earlier run's calendar installed for a later run that announces nothing; the announcement now replaces it, so none is left (install_symbol_calendar_metadata). Witness: tests/test_symbol_calendar_tapes.cpp, "96 checks, 0 failures"; against c7df82e6 "96 checks, 2 failures". Not changed, as reported: _infer_bar_interval_ms (pre-existing, 76482e6) reads a chart's first gap and parses stamps with int(); lanes pass script_tf, so the daily route never infers. A hand-written malformed calendar metadata makes the fingerprint's calendar digest raise, which main already turns into "fingerprint: skipped". Doc anchors, once, on the tree rebased onto main 0411892: of 1743, 275 did not resolve (main's digits moved by this lane's lines, and the lane's own); check_doc_anchors.py --fix took 75, reanchor_doc_citations.py --ref 0411892 --ref 12e3e507 (the lane's head before the rebase, r5/xau-cal-7239) carried 181 by line map, and 21 were set by hand from a main-to-this-tree line map: the four floor-constant citations (ci_verify.py :320, :587; CONTRIBUTING.md, docs/pages/contributing-llm.md), native_c_api.h :1485 (three pages) and :2137-2141, ADR-0001's pine_strategy_host.cpp citations (:1872, :1982, :1933, :1901), the lane's own ADR row (:1958, :2529, :2011), native-feature-parity.md's :3115 and :2005, and two native_c_host.cpp citations (:4048, :3232-3236). check_doc_anchors.py: all 1743 resolve; check_doc_lint.py clean. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
1 parent 0411892 commit 35db01c

94 files changed

Lines changed: 11312 additions & 267 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CONTRIBUTING.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ What each gate refuses:
152152
### The floors
153153

154154
`ci_verify.py` counts the CTest rows that actually **ran** and fails below a
155-
floor — `KERNEL_MIN_TESTS` ci_verify.py:313 and `RELEASE_MIN_TESTS`
156-
ci_verify.py:572.
155+
floor — `KERNEL_MIN_TESTS` ci_verify.py:320 and `RELEASE_MIN_TESTS`
156+
ci_verify.py:587.
157157
A deleted or silently skipped row is a failure, not a quieter run. If your
158158
change adds rows, raise the floor in the same commit and say by how much; if it
159159
legitimately removes one, lower it deliberately and say why. `--min-tests`

‎docs/adr/0001-kernel-adapter-boundary.md‎

Lines changed: 59 additions & 50 deletions
Large diffs are not rendered by default.

‎docs/design/native-feature-parity.md‎

Lines changed: 70 additions & 70 deletions
Large diffs are not rendered by default.

‎docs/native-refactor-progress.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ repository and were never pushed.
194194
K4, the batch log pre-size. Since V19-B's step 6 (`08e71bae`) a run under the
195195
default `NativeEventRetention::Window` keeps no driver point and retires its
196196
journal at every script-bar boundary, so K4 has nothing to size.
197-
`reserve_driver_log` (`src/native_execution_consumer.cpp:2601-2606`) returns
197+
`reserve_driver_log` (`src/native_execution_consumer.cpp:2707-2712`) returns
198198
unless the retention is Full, and `presize_logs`
199-
(`src/native_execution_consumer.cpp:9331-9342`) sizes no journal under Window.
199+
(`src/native_execution_consumer.cpp:9440-9451`) sizes no journal under Window.
200200
`NativeRunSpec::event_retention` (`include/pineforge/native_run_spec.hpp:714`)
201201
defaults to Window, and the Pine adapter declares
202202
`NativeEventRetention::Window` (`src/source/pine_adapter.cpp:2411`). K4 still

‎docs/pages/contributing-llm.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ finding to report, not a step to take.
117117
`scripts/check_doc_reverts.py`.
118118

119119
10. **A test row never silently disappears.** Each profile counts the rows that
120-
*ran* against a floor: `KERNEL_MIN_TESTS` ci_verify.py:313 and
121-
`RELEASE_MIN_TESTS` ci_verify.py:572. Adding rows means raising the floor
120+
*ran* against a floor: `KERNEL_MIN_TESTS` ci_verify.py:320 and
121+
`RELEASE_MIN_TESTS` ci_verify.py:587. Adding rows means raising the floor
122122
in the same commit.
123123

124124
## The recipe for a lane
@@ -252,7 +252,7 @@ policy layer that *uses* kernel features. Where every TradingView rule lives.
252252

253253
**front door** — one of the three ways in: PineScript through codegen, C++
254254
through `NativeStrategyHost` native_host.hpp:845, or C through the
255-
`strategy_native_*` surface (`strategy_native_host_create_v1` native_c_api.h:2677).
255+
`strategy_native_*` surface (`strategy_native_host_create_v1` native_c_api.h:2682).
256256

257257
**twin** — a test unit compiled twice, once against a frozen historical header
258258
closure and once against the current one, so a behaviour change has to be
@@ -264,7 +264,7 @@ measurement that produced it, so a later change to it is visible as a change to
264264
the record, not as an edit to a literal.
265265

266266
**floor** — the minimum number of CTest rows a profile must actually run
267-
(`KERNEL_MIN_TESTS` ci_verify.py:313, `RELEASE_MIN_TESTS` ci_verify.py:572). It
267+
(`KERNEL_MIN_TESTS` ci_verify.py:320, `RELEASE_MIN_TESTS` ci_verify.py:587). It
268268
counts rows that ran, so a skipped row does not pad it.
269269

270270
**receipt** — the recorded evidence an ABI-comparison row needs (a prepared

‎docs/pages/native-engine.md‎

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ spec fields.
470470
The rich `run(bars, n, input_tf, script_tf, inputs, syminfo, overrides, …)`
471471
overload (`engine.hpp:1623-1634`) is **not** refused as a source mutation: it
472472
reaches `NativeExecutionConsumer::run_rich`
473-
(`native_execution_consumer.cpp:9457-9497`), which admits the begin, checks the
473+
(`native_execution_consumer.cpp:9566-9606`), which admits the begin, checks the
474474
timeframe arguments against the spec, preflights and pumps the batch exactly
475475
like the plain overload. `inputs` / `syminfo` / `overrides` are carried only as
476476
`NativeBeginArgs` fields to `prepare_native_begin` — the overrides as the
@@ -638,11 +638,11 @@ a host reacts to its own execution and may submit again. A request born there,
638638
mid-bar on a continuous segment, is eligible on the **remaining path suffix** of
639639
that segment — the birth is admitted at the current cursor and the geometric
640640
search then sees only the unconsumed suffix (`born_on_remaining_path`,
641-
`native_execution_consumer.cpp:5657-5661`). Requests accepted before the
641+
`native_execution_consumer.cpp:5765-5769`). Requests accepted before the
642642
segment, and discrete points, keep the ordinary birth gate above.
643643

644644
`on_native_bar_open` fires at the modeled opening, before that point's matching
645-
pass (`native_execution_consumer.cpp:7112-7114`). **Lookahead warning:** the
645+
pass (`native_execution_consumer.cpp:7220-7222`). **Lookahead warning:** the
646646
`Bar` it receives is the *complete* script bar — the consumer has already set
647647
`engine.current_bar_ = open_view` (`native_execution_consumer.cpp:6983`), the
648648
complete bar unless the spec asks for `NativeOpenBarView::OpenOnly` — so its
@@ -1987,7 +1987,7 @@ bar instead, for a host whose last input is still forming; a D/W/M bar holds
19871987
whole days, so all four are true. Every callback of one script bar carries
19881988
the same four, fills and fill recalculations included, and a C host reads
19891989
the first three from `pf_native_decision_v1`'s session bytes
1990-
(`native_c_api.h:1484`). The kernel resolves each session day once through
1990+
(`native_c_api.h:1485`). The kernel resolves each session day once through
19911991
`native_calendar::session_day_at` (`native_calendar.hpp:455`), which a host
19921992
may call too. `tests/test_native_session_day_facts.cpp` replays the
19931993
TradingView session tapes through a bare host. It is a presentation snapshot
@@ -2108,7 +2108,7 @@ default, set while no run is active — because each row is a full
21082108
the live state, not the run's length: the closed rows enter through a running
21092109
digest). With the switch on,
21102110
one row follows each point, after the extremes that point just folded
2111-
(`record_script_report_point`, `native_execution_consumer.cpp:7993`), so
2111+
(`record_script_report_point`, `native_execution_consumer.cpp:8102`), so
21122112

21132113
```text
21142114
broker_state_hash_len == equity_curve_len == script_bars_processed
@@ -2567,6 +2567,20 @@ TradingView-calibrated, and a host that supplies them inherits its rules:
25672567
session of 2025-10-21 opens 13:45 IST, so its `"60"` bucket is one bar
25682568
stamped 13:45, not 13:15 and 14:15 from the 09:15 day stamp. Every other
25692569
day keeps the day-stamp grid.
2570+
- The installed **daily** bars also date the run's own `"D"` script bars when
2571+
an intraday input aggregates into them: each stamp labels the bar holding
2572+
the session instant it covers (the stamp inside a session, else the next
2573+
session's open), unless an input bar the run holds of that bar comes
2574+
before it. OANDA stamps its XAUUSD daily bars at 17:00 ET, in the break of
2575+
the 1800-1700 session, so that bar is labelled 17:00 ET rather than the
2576+
session's 18:00 open, as TradingView dates it on a daily chart backtested
2577+
with the bar magnifier. Only the label moves: the bar's span, closes and
2578+
values stay the calendar's aggregate, a lookup by the label (the bar's
2579+
open, its sub-bars, its session day) is the bar's own, a bar no stamp
2580+
covers keeps the calendar's label, a label never passes an input bar the
2581+
run holds, and a stamp at the calendar's own open changes nothing.
2582+
Pinned by `tests/test_native_day_labels.cpp` and, on TradingView's tapes,
2583+
`tests/test_daily_magnifier_tapes.cpp`.
25702584

25712585
Declare no `authoritative_bars` and the buckets are a plain aggregation of the
25722586
run's own input, with no calibration to inherit. That is the whole policy
@@ -3064,7 +3078,7 @@ Only completed buckets are published, so this recipe has no lookahead by
30643078
construction. It is the same class the kernel's own subscription evaluator
30653079
aggregates with, and the one the kernel's `script_bucket_completions` query
30663080
feeds when the Pine scheduler asks how its input span buckets
3067-
(`TimeframeAggregator` `native_execution_consumer.cpp:8075`). What it does
3081+
(`TimeframeAggregator` `native_execution_consumer.cpp:8184`). What it does
30683082
**not** give you is what a
30693083
declared subscription does: an `authoritative_bars` feed, the `gaps` and
30703084
`lookahead` delivery rules, the lazy-seal chronology, a C spelling, and the
@@ -3150,7 +3164,7 @@ These are existing refusals, not implied future features:
31503164
A C host has the same stream and the same commands. Streaming needs no new
31513165
symbol — `strategy_stream_begin` and its family (`pineforge.h:739`) take
31523166
a `pf_strategy_t` from `strategy_native_host_create_v1` unchanged — and
3153-
`strategy_native_submit_v1` (`native_c_api.h:2718`) obeys the one legality
3167+
`strategy_native_submit_v1` (`native_c_api.h:2723`) obeys the one legality
31543168
rule its C++ spelling does.
31553169
31563170
Rebuild strategy libraries against this engine. An ABI-v4 module without the

0 commit comments

Comments
 (0)