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 39cc605
Browse filesBrowse the repository at this point in the historyBrowse files
Docs: F7's records and the citations its src edits moved (R5 lane F7)
design/native-feature-parity.md:
* MG9 -- the kernel's FxRoll point stays refused for the measured
MG-FX reason; §4.4's two N6 follow-ups are closed (the leveraged
carried roll takes TradingView's broker-open checkpoint; a staged FX
series keeps Sized wherever the acceptance coordinate converts at the
source's rate) with their named expectations;
* §4.1 E3 -- the conversion exists once, in the kernel, for default AND
typed quantities; what the adapter keeps is listed with its witnesses;
* OL4 -- M27's measured reason (same-call source commands the kernel has
not seen; the __close__<id> label);
* §4.1 E8 -- M26 recorded: the pre-run TimeframeAggregator pass is kept
because its count is needed before the first input and the kernel
offers no pre-run interval query (a kernel capability F7 did not add);
* row g -- pine_path_resolve.cpp is 83 lines, the override-reading
overload is gone;
* §3.6.2 -- anchored relative trailing legs name no best_seed and no
tape measures them: recorded as an open measurement with the tape it
needs, not changed.
MG7, L3, L4 and E2 were corrected with the D2 commit.
Citations: every pine_adapter.cpp / pine_path_resolve.cpp anchor in the
published pages moved through an exact difflib line map from fd78592's
copy to this tree (164 moved; E20's reanchor tool). Three sat in changed
blocks and were set by hand: SZ3's default_sizing_units span, row g's
entry_stop_first_touch, and OL13's reversal-gap bracket policy, whose two
symbol-less anchors (:12912, :12940 at fd78592) pointed into
carried_pooc_short_margin_before_script_scope -- deleted by this lane as
dead -- and now name apply_reversal_gap_bracket_policy and
reaccept_gapped_bracket_behind_same_id_add. docs/pages/native-engine.md
carries one moved digit (pine_path_resolve.cpp:41 -> :36).
check_doc_anchors: 1563/1563 resolve; check_doc_lint, design inventory,
feature rulings and spec shadowing unchanged and passing.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit 0e050d115a77ebdb4e72e9d02a3d06542cab2cb0)
-**Margin.** The kernel owns the margin *mechanism* — the level solve, the check points, the
224
224
kernel request, its re-pricing, the receipt — and the adapter answers its three policy hooks
225
-
with TradingView's: `margin_check_allowed` (`pine_adapter.cpp:12413`) for the scheduling,
226
-
`resolve_margin_requirement` (`pine_adapter.cpp:12446`) for the ten-significant-digit money,
225
+
with TradingView's: `margin_check_allowed` (`pine_adapter.cpp:12319`) for the scheduling,
226
+
`resolve_margin_requirement` (`pine_adapter.cpp:12355`) for the ten-significant-digit money,
227
227
and `resolve_margin_call_units` for the lot-floored 4x restore. That hook answers every call
228
228
on purpose (R5 lane F7): TradingView floors the restore onto the lot grid before the multiple,
229
229
so on a gridded tape the kernel's own `ShortfallMultiple 4` books 5 lots where TradingView
@@ -234,17 +234,17 @@ kernel and own these quirks, each at its site:
234
234
margin since F7), while the roll point measures at the remaining path's adverse mark (MG-FX:
235
235
0.4116 @ 97 there against TradingView's 0.3996 @ 100). What has no kernel check point at all
236
236
stays adapter-side: the `process_orders_on_close` chronology exception
237
-
(`non_pooc_commissioned_short``pine_adapter.cpp:14992`), the pre-open admission slice and
237
+
(`non_pooc_commissioned_short``pine_adapter.cpp:14816`), the pre-open admission slice and
238
238
the 1x-long money call — plus the TV admission scopes
239
239
(`src/compat/pine/market_admission.cpp:33-46`) and the review fold they feed (`:67-72`,
240
240
`:79-136`).
241
241
-**Calculation timing.** The cadence itself is the kernel's: a `calc_on_order_fills` strategy
242
242
projects `NativeCalculationTrigger::BarCloseAndFills` with TradingView's guard literal as
243
243
`max_recalculations_per_point`. What stays are the specifics COOF adds on top —
244
244
the language-state snapshot/restore around a recalculation, the waypoint-only refill deferral
245
-
(`next_source_path_waypoint``pine_adapter.cpp:6686`), the first-open execution chain and its
245
+
(`next_source_path_waypoint``pine_adapter.cpp:6597`), the first-open execution chain and its
246
246
own loop guard (`pine_scheduler_native.cpp:688`), and the two fills Pine refuses to
247
-
recalculate on (`suppress_grouped_stop_recalc``pine_adapter.cpp:4036`).
247
+
recalculate on (`suppress_grouped_stop_recalc``pine_adapter.cpp:3973`).
248
248
-**Pine language state and harness flags.** Series and position-view freezing
249
249
(`PineLanguageState``pine_language_state.hpp:12`); the three session flags generated code
250
250
reads, `PineStrategyHost` members since R5 lane F5 (`session_ismarket_`
@@ -291,7 +291,7 @@ citations, 264 are in `src/source/` and its headers; 6 sit in kernel files
291
291
between `round_to_mintick` and `bar_fill_price`), deleted by R5 lane E6; the `:73-180` span
292
292
earlier drafts cited is and was live code (`ClosedLotExcursionFacts`, `PyramidEntry`,
293
293
`Trade`, each with its own doc). The arithmetic is
294
-
adapter-side (`pine_adapter.cpp:396-403`). `strategy.close` batching and the entry-id ledger
294
+
adapter-side (`pine_adapter.cpp:390-397`). `strategy.close` batching and the entry-id ledger
295
295
are **gone** from the kernel — the ledger is adapter state (`pine_adapter.hpp:1247-1258`) and
296
296
only names survive in comments. The TradingView margin-call toggle is **gone**: there is no
297
297
`set_margin_call_enabled` in the tree, and what enables the model is the presence of
@@ -517,13 +517,13 @@ Every line number in this section names its symbol on this tree, which
517
517
<!-- native-feature-rulings:begin -->
518
518
|`NativeRunSpec` field | ruling | what the adapter runs instead | measurement and ruling of record | executed native consumers |
519
519
|---|---|---|---|---|
520
-
| `price_grid`, `grid_rounding` | **native-only** | TradingView's per-order-kind tick rules on top of `None`: `source_trigger_threshold` (`pine_adapter.cpp:329`), `source_level_on_price_grid` (`:315`), `nearest_tick` (`:253`) / `source_bar_fill_tick` (`:274`) / `directional_tick` (`:298`), behind the terms seam | R5-3 and design risk E7 ruled `None` for the adapter before the lane ran; lanes R7 and N13 measured the alternative anyway (raw levels submitted, `QuantizeFillsAndTriggers` with `HalfUp` declared). L8b closed the first blocker (no run aborts). The second has no remedy on either side: TradingView quantizes per order kind (stop and limit legs and a trail's activation on the quantized bar; the trail stop, the running best, stop-limit entries and the `calc_on_order_fills` cursors raw), the grid is one rule for the run, and it still moves 30 pinned checks in 4 units; a per-kind mask would spell that inconsistency into the kernel. The corpus cannot arbitrate (every probe runs a 0.01 tick on an on-grid feed; 5 of 312 differ in an engine-only column). Permanent witness: `tests/test_adapter_grid_relower.cpp`, whose section 5 pins the trail stop the grid fires a bar early. Design row PG and §3.6 | `examples/native/native_price_grid_strategy.cpp`, `examples/native/native_price_grid_c.c`, `tests/test_native_price_grid.cpp` |
521
-
| `risk` | **native-only** | all of `strategy.risk.*` but the direction: `update_risk_state` (`pine_adapter.cpp:12211`), `SourceDayLedger`, `submit_intraday_loss_close` (`pine_adapter.cpp:13291`), `chart_day_key` (`pine_adapter.cpp:12105`), `compat::pine::IntradayCap` with `IntradayOrderBudget` (337 lines) | Structural first: Pine's risk calls are per-bar statements, so a limit reaches the adapter on script bar 0, after `project()` (`pine_strategy_host.cpp:314`) and `configure_native` (`pine_strategy_host.cpp:315`) have fixed and digested the spec. In substance (lane N12, `tests/test_adapter_risk_relower.cpp`, 62 checks over nine paired scenarios): the drawdown latch samples at the close only and still admits a reversal; the loss-day streak counts trades, not days; the intraday loss closes at the path's adverse extreme, refuses every placement and withdraws the book; the fill cap charges slots, transfers quota and closes at the bar's better extreme on the chart timezone's day. With the kernel seeded on the corpus, 3 of 4 cap probes diverge (3840 of 3916, 312 of 604, 2370 of 2384 rows). `strategy.risk.allow_entry_in` is the one rule that is the kernel's already (`allowed_open_directions`). Design §3.6 | `examples/native/native_risk_limits_strategy.cpp`, `examples/native/native_trail_risk_strategy.cpp`, `tests/test_native_risk_limits.cpp`, `tests/test_native_c_api.c` |
522
-
|`max_abs_units`|**adapter-policy**|`strategy.risk.max_position_size` as a gate on the LIVE book before the fill (`pine_adapter.cpp:11499-11500`): an entry is refused once the book already holds the limit | design row MG2 (R5-1): the resulting-book cap is the generic one. Measured by N12's scenario `PS` in `tests/test_adapter_risk_relower.cpp`: two-unit entries against a limit of 3 leave the adapter at 4 and the kernel cap at 2 |`tests/test_native_resting_matching_contract.cpp`, `tests/test_native_run_spec.cpp`|
523
-
|`max_open_lots`|**adapter-policy**| Pine pyramiding is a per-cycle entry count in the adapter's command policy; a resting source entry must not consume a physical-lot cap before it fills (`pine_adapter.cpp:1494-1496`) | design row MG3 (R5-1); the contract comment in `project()`|`tests/test_native_resting_matching_contract.cpp`, `tests/test_native_margin_model.cpp`|
524
-
|`initial_margin_fraction`|**adapter-policy**| TradingView's ten-significant-digit money admission against the signal-time tuple, answered as `AdmitWithHostMargin`; the `margin` model the adapter does declare is maintenance-only (`NativeMarginModel``pine_adapter.cpp:1583-1591`, `margin.maintenance_long``pine_adapter.cpp:1598`) | design row MG4 and the wave-4 ruling recorded in `project()`: a positive initial requirement would decline openings TradingView takes |`tests/test_native_precommit_view.cpp`, `tests/test_native_margin_model.cpp`|
525
-
|`report_open_position_at_end`|**adapter-policy**| TradingView's range-end report re-marks the curve's last point and re-folds every extreme from it (`scheduler_record_range_end`): report shape, not a mark-to-market row (`pine_adapter.cpp:1530-1537`) | design row RP5; the kernel reads the field under `KernelRecorded` only, which `scripts/check_adapter_spec_shadowing.py` gates |`examples/native/native_sized_report_strategy.cpp`, `tests/test_native_report_truth.cpp`|
526
-
|`open_bar_view`|**adapter-policy**|`Complete`: TradingView's bar-open scheduling and its `calc_on_order_fills` callback read the whole script bar (`pine_adapter.cpp:1521-1522`) | design rows CT4 and E5: the open-only view is opt-in because the adapter needs the full bar |`examples/native/native_calc_on_fills_strategy.cpp`, `tests/test_native_calc_timing.cpp`|
520
+
| `price_grid`, `grid_rounding` | **native-only** | TradingView's per-order-kind tick rules on top of `None`: `source_trigger_threshold` (`pine_adapter.cpp:323`), `source_level_on_price_grid` (`:309`), `nearest_tick` (`:247`) / `source_bar_fill_tick` (`:268`) / `directional_tick` (`:292`), behind the terms seam | R5-3 and design risk E7 ruled `None` for the adapter before the lane ran; lanes R7 and N13 measured the alternative anyway (raw levels submitted, `QuantizeFillsAndTriggers` with `HalfUp` declared). L8b closed the first blocker (no run aborts). The second has no remedy on either side: TradingView quantizes per order kind (stop and limit legs and a trail's activation on the quantized bar; the trail stop, the running best, stop-limit entries and the `calc_on_order_fills` cursors raw), the grid is one rule for the run, and it still moves 30 pinned checks in 4 units; a per-kind mask would spell that inconsistency into the kernel. The corpus cannot arbitrate (every probe runs a 0.01 tick on an on-grid feed; 5 of 312 differ in an engine-only column). Permanent witness: `tests/test_adapter_grid_relower.cpp`, whose section 5 pins the trail stop the grid fires a bar early. Design row PG and §3.6 | `examples/native/native_price_grid_strategy.cpp`, `examples/native/native_price_grid_c.c`, `tests/test_native_price_grid.cpp` |
521
+
| `risk` | **native-only** | all of `strategy.risk.*` but the direction: `update_risk_state` (`pine_adapter.cpp:12117`), `SourceDayLedger`, `submit_intraday_loss_close` (`pine_adapter.cpp:13118`), `chart_day_key` (`pine_adapter.cpp:12011`), `compat::pine::IntradayCap` with `IntradayOrderBudget` (337 lines) | Structural first: Pine's risk calls are per-bar statements, so a limit reaches the adapter on script bar 0, after `project()` (`pine_strategy_host.cpp:314`) and `configure_native` (`pine_strategy_host.cpp:315`) have fixed and digested the spec. In substance (lane N12, `tests/test_adapter_risk_relower.cpp`, 62 checks over nine paired scenarios): the drawdown latch samples at the close only and still admits a reversal; the loss-day streak counts trades, not days; the intraday loss closes at the path's adverse extreme, refuses every placement and withdraws the book; the fill cap charges slots, transfers quota and closes at the bar's better extreme on the chart timezone's day. With the kernel seeded on the corpus, 3 of 4 cap probes diverge (3840 of 3916, 312 of 604, 2370 of 2384 rows). `strategy.risk.allow_entry_in` is the one rule that is the kernel's already (`allowed_open_directions`). Design §3.6 | `examples/native/native_risk_limits_strategy.cpp`, `examples/native/native_trail_risk_strategy.cpp`, `tests/test_native_risk_limits.cpp`, `tests/test_native_c_api.c` |
522
+
|`max_abs_units`|**adapter-policy**|`strategy.risk.max_position_size` as a gate on the LIVE book before the fill (`pine_adapter.cpp:11405-11406`): an entry is refused once the book already holds the limit | design row MG2 (R5-1): the resulting-book cap is the generic one. Measured by N12's scenario `PS` in `tests/test_adapter_risk_relower.cpp`: two-unit entries against a limit of 3 leave the adapter at 4 and the kernel cap at 2 |`tests/test_native_resting_matching_contract.cpp`, `tests/test_native_run_spec.cpp`|
523
+
|`max_open_lots`|**adapter-policy**| Pine pyramiding is a per-cycle entry count in the adapter's command policy; a resting source entry must not consume a physical-lot cap before it fills (`pine_adapter.cpp:1478-1480`) | design row MG3 (R5-1); the contract comment in `project()`|`tests/test_native_resting_matching_contract.cpp`, `tests/test_native_margin_model.cpp`|
524
+
|`initial_margin_fraction`|**adapter-policy**| TradingView's ten-significant-digit money admission against the signal-time tuple, answered as `AdmitWithHostMargin`; the `margin` model the adapter does declare is maintenance-only (`NativeMarginModel``pine_adapter.cpp:1567-1575`, `margin.maintenance_long``pine_adapter.cpp:1582`) | design row MG4 and the wave-4 ruling recorded in `project()`: a positive initial requirement would decline openings TradingView takes |`tests/test_native_precommit_view.cpp`, `tests/test_native_margin_model.cpp`|
525
+
|`report_open_position_at_end`|**adapter-policy**| TradingView's range-end report re-marks the curve's last point and re-folds every extreme from it (`scheduler_record_range_end`): report shape, not a mark-to-market row (`pine_adapter.cpp:1514-1521`) | design row RP5; the kernel reads the field under `KernelRecorded` only, which `scripts/check_adapter_spec_shadowing.py` gates |`examples/native/native_sized_report_strategy.cpp`, `tests/test_native_report_truth.cpp`|
526
+
|`open_bar_view`|**adapter-policy**|`Complete`: TradingView's bar-open scheduling and its `calc_on_order_fills` callback read the whole script bar (`pine_adapter.cpp:1505-1506`) | design rows CT4 and E5: the open-only view is opt-in because the adapter needs the full bar |`examples/native/native_calc_on_fills_strategy.cpp`, `tests/test_native_calc_timing.cpp`|
527
527
|`subscriptions`|**adapter-hook**|`declare_timeframe_subscriptions` from the begin-time hook (`pine_strategy_host.cpp:1661`): a plain `request.security` site is a kernel subscription | lane R3b over the L6c hook: 21 of the corpus's 23 `request.security` probes run their sites on the kernel, byte-identical; the sites the predicate leaves out (lower timeframe, lookahead, auxiliary, streams) keep the source evaluator |`examples/native/native_htf_strategy.cpp`, `tests/test_native_htf_subscriptions.cpp`|
528
528
|`auxiliary_feed`|**adapter-policy**| the adapter's own auxiliary drive: the chart-slice mapping and the deferred first bucket (`src/source/pine_aux_security.cpp`) | lane N7, retained on three measurements: 0 of 312 corpus probes install an auxiliary feed; TradingView's chart slice leaves pre-range coverage inert where the kernel folds it by time, and evaluates after the bar's matching pass where the kernel delivers before it (`tests/test_native_auxiliary_feed_twin.cpp`, rows B and C). Design §2.iv |`tests/test_native_auxiliary_feed.cpp`, `tests/test_native_auxiliary_feed_stream.cpp`|
529
529
<!-- native-feature-rulings:end -->
@@ -601,7 +601,7 @@ The comment survived the code. They are not rule-2 questions at all; they are ru
601
601
|`src/engine_run.cpp:162-186`|`process_orders_on_close` semantics |`reset_run_state()` at `:85`, unrelated |**residue.** The live mechanism is the spec field `NativeCloseExecution::AfterCalculation` (`native_run_spec.hpp:27`) |
602
602
|`include/pineforge/engine.hpp:1136-1204`| TradingView freezes default market-order sizing at the signal bar |`net_profit()` at `:935`; `:1136`-`:1255` is one comment block |**residue.** The live mechanism is `native_order::SizePrice` (`Signal`, `SignalOnTick`) with `SizeTime::AtAcceptance` — a request value that names no platform |
603
603
|`include/pineforge/engine.hpp:1226-1255`| TradingView liquidates intrabar, before the bar-close script body |`net_profit()` at `:935`|**residue.** The live mechanism is `NativeLiquidationCheck` (`native_run_spec.hpp:157`), whose three values are three broker models |
604
-
|`include/pineforge/engine.hpp:896-916` (the row first named `:73-180`, which is and was live code: `ClosedLotExcursionFacts`, `PyramidEntry`, `Trade`) | the ten-significant-digit money rule |`bar_fill_price`, whose own live doc was kept |**residue** (already recorded above): the arithmetic is `pine_adapter.cpp:396-403`. **Deleted by R5 lane E6.**|
604
+
|`include/pineforge/engine.hpp:896-916` (the row first named `:73-180`, which is and was live code: `ClosedLotExcursionFacts`, `PyramidEntry`, `Trade`) | the ten-significant-digit money rule |`bar_fill_price`, whose own live doc was kept |**residue** (already recorded above): the arithmetic is `pine_adapter.cpp:390-397`. **Deleted by R5 lane E6.**|
605
605
606
606
**For a code lane, not this document:** these blocks total **312 lines** — `engine_orders.cpp`
607
607
`:200-224` and `:556-697`, `engine_run.cpp``:162-186`, `engine.hpp``:1262-1381` — and not one
0 commit comments