Skip to content

Commit 87b3b06

Browse files
luisleo526claude
andcommitted
Docs: the price grid's reached rule and its scope per mode (R5 lane L8b, item 4)
docs/pages/native-engine.md, price grid: the "known limit" bullet that described B1 is replaced by the ruling -- under QuantizeFillsAndTriggers the tick-quantized print is the reached price, the core re-validates on the same ladder through native_order::ActivationGrid, reached_price records the quantized print, a trail's best and stop and the zero-offset ride follow the one rule, a limit is gated on its resolved price only, and the fill books where the mode already says -- plus the scope per mode (None and QuantizeFills keep the raw compare bit for bit), the rejected alternative reading, and the birth-print exclusion that moves an AfterCalculation reissue's fill to the next open. Co-Authored-By: Claude Fable 5.1 <[email protected]> (cherry picked from commit c3ccd293a9626aef8dcfef77246f7e77bb52d747)
1 parent 2effe5a commit 87b3b06

1 file changed

Lines changed: 35 additions & 8 deletions

File tree

‎docs/pages/native-engine.md‎

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,41 @@ never sets it, so Pine-compatible runs are unchanged.
212212
two-decimal feed, and the grid then fires it a tick early where TradingView
213213
holds (tests/test_adapter_grid_relower.cpp). A per-kind grid mask would
214214
spell that inconsistency into the kernel and is not generic.
215-
- Known limit of `QuantizeFillsAndTriggers` on a sub-tick feed: a cursor print
216-
that is inside the quantized region but short of the raw level (a bar
217-
opening at 100.40 under a buy stop at 100.50 on a 0.25 ladder) is reported
218-
by the matcher and then refused by the core's raw activation check, so the
219-
run fails closed with `native working-request preparation failed` instead
220-
of filling. The same witness pins the reproducer; until an activation's
221-
reached price is ruled on, use the trigger mode on feeds already on the
222-
ladder, or `QuantizeFills` alone.
215+
- The reached rule (R5 lane L8b). Under `QuantizeFillsAndTriggers` the
216+
tick-quantized print **is** the reached price. The matcher's verdict is
217+
authoritative, and the core re-validates every activation — stop,
218+
stop-limit, trail arm, trail stop — on the same ladder with the same
219+
arithmetic: the consumer hands `native_order::ActivationGrid` to
220+
`prepare_trigger` the way acceptance receives `CommandContext::price_tick`,
221+
so a hit the matcher reports is never refused. Reached means the level
222+
itself (a crossing hit books the level) or a print inside the quantized
223+
region: its nearest tick under `HalfUp`, its enclosing tick on the region's
224+
side under `Directional`, at or past the level's own ladder point. The
225+
activation's recorded `reached_price` is that quantized print. A limit has
226+
no core re-validation; its gate is limit-or-better on the resolved price,
227+
which the grid's cap keeps. One rule for every kind: a trail's running best
228+
is the quantized print too (nearest under `HalfUp`, the favourable enclosing
229+
tick under `Directional`), `best - offset` is tested by the same rule, and a
230+
zero-offset ride exits on the first print strictly past the best on the
231+
ladder. TradingView's per-kind split (a raw best and a raw trail stop next
232+
to quantized stop and limit legs) is not spelled here; the adapter keeps it
233+
on `None`. The fill books where the mode already says a fill books: the
234+
level, or the gapped open, then the fill rounding, then
235+
`resolve_execution_terms`. Example: a buy stop at 100.50 on a 0.25 ladder
236+
with the bar opening at 100.40 activates at the open and books 100.50; under
237+
`None` and `QuantizeFills` the raw open never reaches it and nothing fills.
238+
- Scope per mode. `None` and `QuantizeFills` keep the raw compare on the raw
239+
print for every activation, bit for bit (`QuantizeFills` quantizes fills
240+
only). Only `QuantizeFillsAndTriggers` tests and re-validates on the ladder.
241+
The alternative reading — the raw print stays authoritative and the matcher
242+
must not accept a quantized touch at a resting cursor — was rejected: an
243+
intrabar crossing already books a quantized touch at the level, so it would
244+
make a gapped open second-class for no reason but the core's compare, and
245+
it would collapse the trigger mode toward `QuantizeFills`. A leg born at a
246+
bar's calculation is first tested at the next point (its own birth print is
247+
excluded), so a `close_execution = AfterCalculation` leg reissued at the
248+
close and reached by that close's print fills at the next open
249+
(tests/test_native_price_grid.cpp, sections L8b-1 to L8b-4).
223250

224251
Timeframe arguments on `run` / `stream_begin` must be **omitted/empty or
225252
byte-identical** to the spec. Conflicting values are a preflight refusal:

0 commit comments

Comments
 (0)