You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 37090e1
Browse filesBrowse the repository at this point in the historyBrowse files
H-MEASURE: measure excursions, short-seed swaps, the dust sweep, ismarket
AUDIT4 X14 rows E19 (the excursion model, G2-22), G2-21 (short-seed
report swaps), G2-32 (the 1e-10 dust sweep) and G2-36 (session.ismarket,
the CME weekend and 0000-2400 classes), each measured against the kernel
on the same fills and against TradingView's own trades (lab tv,
ws-report-v1, rangeProof covered; each fixture README names its tapes):
- tests/test_e19_excursion_tape.cpp (E19): a corpus probe's own script
re-exported (1580 trades, its excursion cells equal to the corpus
tape's) and a calc_on_order_fills scratch tape. Where the host-owned
model (RULING A48) and the kernel sampler differ, the kernel's number is
TradingView's: entry-bar over-mask, exit-bar over-fold after an at-open
exit, the COOF scratch TradingView reports as 0/0. One trade per class
pinned; corpus-wide the kernel is TradingView's on 315 of the 326
identified disagreements and the host on none. Recorded divergences.
- tests/test_short_seed_report_swap.cpp (G2-21): the swap relabels two
rows' entry_incarnation into ab9714b's numbering, read against the
kernel's own lot identities in the same run; TradingView exports no
incarnation, and the Pine host books the collision tape's 13 rows.
- tests/test_pine_dust_sweep_paired.cpp (G2-32): the sweep erases a dust
lot inside a live book, unlike ab9714b's whole-book reset; TradingView's
decimal quantities leave no remnant row, which the Pine host books and a
bare host does not (four 2.8e-17-unit rows).
- tests/test_session_ismarket_tape.cpp (G2-36): six tapes (ES1!, EURUSD,
XAUUSD, ETH; both 2025 DST switches, Thanksgiving) flag every bar in
market; the kernel's in_session matches every spelling, the generated
predicate misses every Sunday open under a :23456 mask and every bar of
0000-2400. Routing session.ismarket is a codegen change, not made here.
Docs: ADR-0001 (the excursion seam, the dust sweep as a quirk, the
session.ismarket selection, the excursion columns being report-only),
design RP1, RP5 (its "measured in §3.7 part 2" named no short-seed row)
and the excursion-mode alternative, native-settlement.md's sweep
paragraph ("restates" the legacy rule, it does not), pine-to-native.md
and pine_v6_coverage_detail.md on session.ismarket.
No src/ or include/ change.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit fd3c72e2d6cc22a77b86a73d2efc36aeed7c968f)
INT26 pick note: docs/native-settlement.md conflicted in text. INT25
(K-ULP4) had appended the sentences on the adapter not declaring the kernel's
quantity tolerance to the paragraph this commit rewrites; the merged
paragraph is this commit's measured text followed by those INT25 sentences
unchanged. The ADR, design and pine-to-native pages conflicted on citation
digits only (int16_digit_merge, digits carried from the pre-pick tree).
hunkcheck: every hunk of fd3c72e2 carried; design and pine-to-native differ
from its diff in anchor digits only.
`set_probe_suppress_tail_logic``pine_strategy_host.hpp:472`), whose live-probe protocol is
@@ -695,7 +713,7 @@ The table records, at the tree the doc wave read, what each block described and
695
713
| the neutral utility spellings — `map.hpp`, `drawing.hpp`, `series.hpp`, `window_sum.hpp`, `math.hpp`, `matrix.hpp`, `session_time.hpp`, `str_utils.hpp`| neutral public names with exact deprecated `pine_*` aliases for generated code | already ruled: "Neutral spellings" above | dropping the aliases breaks generated code | the ruled-name gate |
696
714
| `native_matching::ladder_trail_stop` `src/native_matching.hpp`, reaching the core as `native_order::ActivationGrid::ladder_tick` | a trailing stop that stands a whole number of price ticks from a running best that is itself a ladder point IS the ladder point that many ticks away, spelled so no binary64 ULP hides it from the side it is reached from; everything off the ladder keeps `best -/+ offset` raw | a stop `ticks` ticks behind a best is a ladder distance at every venue with a tick ladder, and the rule reads the run's own declared `price_tick` — data, never a platform. It is a defect of arithmetic, not a policy: `11.44 - 5 * 0.01` is `11.389999999999998792` against the ladder point `11.390000000000000568`, so a print that IS 11.39 missed a stop the run had put five ticks under 11.44. Both ends are decimal numbers measured on the host's ladder and only the ladder index is exact between them | nothing, because the run had already decided it — it declared the ladder (`NativeRunSpec::price_tick`) and the host spelled the distance on that ladder (`TrailTicks`, or an equal price distance), so a "raw subtraction or ladder point" switch would put a hash-visible choice on the public surface for an answer already given. Nor is this the per-order-kind quantization the `price_grid` row rejects: nothing is rounded ONTO the ladder, and a sub-tick best, a fractional-tick offset or a run with no declared tick keep the raw level bit for bit | `tests/test_native_trail_stop_ladder.cpp` (kernel-only, batch and stream: lane E14's own 11.44 / 5-tick case against a low of exactly 11.39, its buy mirror, and the three off-ladder shapes pinned bit for bit), with the tape row in `tests/test_trail_activation_tick_reach.cpp` (`e14-f-long-shallow-next` 7/7) and the two paths agreeing in `tests/test_adapter_grid_relower.cpp` section 5. Measured by TradingView's tape (R5 lane E14) and by the price-grid trial from the other side (lane R7: one ULP off on ~14% of (best, offset) pairs), closed by lane E16; design `native-feature-parity.md` §3.6.2 |
697
715
| `native_order::Trail::best_seed` `include/pineforge/native_order.hpp` | where a trail's running best STARTS: absent, the arm's own print; present, a floor on it — the favourable one of the seed and that print | the level is a number the host hands over exactly as it hands over an `arm_price`: the kernel neither derives it nor knows what named it, and a second venue drives it by passing a different number. A trailing stop that rides from its activation rather than from the next print is an ordinary broker shape | nothing, because the old start was not a choice the run had made another way — it was wherever the arm happened to land (the arm threshold on a crossing, the first live print when the request was born already armed), so there is no second spelling to defer to and nothing for a hook to answer; a request field is admissible, opt-in and hashed only when present | `tests/test_native_trail_best_seed.cpp` (kernel-only, batch and stream, the absent-seed controls pinned as same-host properties of the continuation digest rather than as its pre-field values, because that digest folded the host's own zoneinfo root when the lane landed — E23 made it portable across hosts, but it still moves with the installed tzdata release, so the properties stay); the C tail by `check_trail_best_seed_tail` in `tests/test_native_c_api.c`. The need was measured by R5 lanes E5 and E9 — TradingView's `lab tv` tapes book every trail exit at activation ∓ the offset, never at the kernel's own start — and closed by lane E14; design `native-feature-parity.md` §3.6.2 |
698
-
| `build_close_trade_with_costs` and `record_close_trade` `src/engine_orders.cpp` | a closing row's percent P&L is its NET P&L (both commissions deducted) over its entry cost at the same account-currency rate; its excursions include the exit fill itself and sit on the net open-profit basis (the entry commission deducted, the favorable magnitude floored at 0); a row whose P&L is exactly zero counts as even | accounting definitions over the row's own booked numbers -- entry cost, commissions, fill price -- so another venue is driven by its own fees and fills; nothing branches on a platform | a gross/net or tolerance switch over report arithmetic the run's fee terms already decide. One question stays open, recorded at the site: the net basis is applied to a host-owned excursion's magnitudes too (RULING A48's hook) | the corpus parity gate (`scripts/check_corpus_parity.sh`: 312 recorded trade lists carrying the percent P&L and both excursion columns, graded against TradingView's exports) and `tests/test_max_contracts_held.cpp` (a zero-P&L row counted even); the calibration records are the comments at the site (R5 lane F6 reworded them to the mechanism) |
716
+
| `build_close_trade_with_costs` and `record_close_trade` `src/engine_orders.cpp` | a closing row's percent P&L is its NET P&L (both commissions deducted) over its entry cost at the same account-currency rate; its excursions include the exit fill itself and sit on the net open-profit basis (the entry commission deducted, the favorable magnitude floored at 0); a row whose P&L is exactly zero counts as even | accounting definitions over the row's own booked numbers -- entry cost, commissions, fill price -- so another venue is driven by its own fees and fills; nothing branches on a platform | a gross/net or tolerance switch over report arithmetic the run's fee terms already decide. One question stays open, recorded at the site: the net basis is applied to a host-owned excursion's magnitudes too (RULING A48's hook) | the corpus parity gate (`scripts/check_corpus_parity.sh`: 312 recorded trade lists carrying the percent P&L and both excursion columns, byte-pinned to the baseline; the excursion columns are read against TradingView's exports as report-only deltas, not graded, `scripts/verify_corpus.py`) and `tests/test_max_contracts_held.cpp` (a zero-P&L row counted even); the calibration records are the comments at the site (R5 lane F6 reworded them to the mechanism) |
699
717
| the indicator library -- `include/pineforge/ta.hpp`, `src/ta_moving_averages.cpp`, `src/ta_oscillators.cpp`, `src/ta_extremes_volume.cpp`, `src/ta_volatility_trend.cpp`, `src/ta_misc.cpp`, `include/pineforge/window_sum.hpp`, `include/pineforge/math.hpp`| each indicator implements its Pine `ta.*` / `math.*` definition -- warm-up and na rules, the window call-site ring, the compensated window sum, tie and epsilon rules -- and its comments record the TradingView tape or export that calibrated each number (the `ta::ATR` and standard-deviation rows above are two of them) | an indicator is a function of its inputs, the same for every venue; generated strategies call exactly these classes, and where two textbook conventions genuinely compete the choice is a per-instance option (`ta::EmaSeeding`), never a branch on the platform | a convention switch on every indicator, for a choice the script already made by calling that Pine function | the kernel-only TA suites `tests/test_ta_*.cpp` and the corpus parity gate |
700
718
| the formatting library -- `include/pineforge/str_utils.hpp`, `src/str_utils.cpp` (`str_tostring`, `str_format_values`, `str_format`) | the number text of Pine's `str.tostring` / `str.format` built-ins: a number's shortest round-trip decimal spelling, scaled and rounded half-up on its digits, the default, `percent`, `volume` (K / M / B / T) and pattern modes, MessageFormat placeholders and quoting, `NaN` and `Infinity` -- the published rendering TradingView's exported tapes pin (R5 lane C6), ported from the codegen formatter (lane C6b) by R5 lane B-ENGINE; the `mintick` mode, which generated code delegates to it, is kept as it was | a formatting library is a function of its inputs, the same for every venue, as the indicator library is: it spells a number the way the source language's own `str.*` library defines, and no kernel order, fill, settlement, margin or hash code calls it -- of the thirty-five kernel translation units only `src/str_utils.cpp` names these functions | a rendering switch on functions whose definition the calling script chose by calling them | `tests/test_str_number_format.cpp` (lane C6b's 42-case edge battery, every numeric string of lane C6's TradingView exports, byte-identical output on macOS arm64 and Linux x86-64) and `tests/test_str_utils.cpp` |
701
719
| the language calendar functions -- `include/pineforge/session_time.hpp`, `src/session_time.cpp` (`timeframe_time`, `local_hour` and its siblings, `session_in_market`, `session_trading_day_open_ms`, ...) | the definitions of Pine's `time()` / `time_close()` / bare-time / `session.is*` built-ins for generated code: session and timezone parsing, the invalid- and 24-hour-session spellings, `time("60")` day keying, `session.is*` on daily charts, each comment naming the tape that pinned it | the inputs are data -- a session string, a timezone, a timeframe -- so another venue is driven by its own session template; nothing branches on a platform, and a native host's calendar is the separate generic `native_calendar`| a rules switch on functions whose definition the generated script chose by calling them |`tests/test_session_time.cpp`, `tests/test_pine_time_day_stamp_grid.cpp` and the corpus parity gate |
0 commit comments