Skip to content

Commit 9dc3fc0

Browse files
committed
Adapter: a process_orders_on_close limit entry fills at the close that placed it when the close's tick reaches it, with or without calc_on_order_fills (R5 lane PAR-ORDERS-3, finding 3)
The post-calculation close pass (fill_pooc_close_entries) tested a pure limit entry placed by the bar's close calculation against the RAW close, and skipped every limit under calc_on_order_fills (bc5f7a21 pine_adapter.cpp:16649-16671). TradingView reads the close's TICK, as the pass already did for a stop, with or without calc_on_order_fills (lab tv pa3-f3-pooc-limit-{long,short}{,-coof}, NYSE:F 15m, 2025-07-01..08, tests/fixtures/pooc_limit_close): a sell limit at 11.76 over a raw 11.755 close (tick 11.76) and at 11.86 over 11.855 fill at that close; a buy limit at 11.65 over a raw 11.655 close (tick 11.66) and at 11.74 over 11.745 rest, and so does every limit only the bar's range reached -- each fills on the next bar's touch. PAR-ORDERS-2 recorded the short case on pa2-i2-level-w1-short-pooc, cycle 2 (bar 31: TradingView fills A's sell limit at the close its high already reached, the engine on bar 32). pure_limit no longer excludes calc_on_order_fills, and at_close compares the close's tick for a limit as for a stop (pine_adapter.cpp:16654-16675). Rows: tests/test_pooc_limit_close_tapes.cpp (new, 28 checks; 4 fail on bc5f7a21 and on the base: both short tapes' j = 22 and j = 31 entries a bar late); tests/test_second_extreme_order_tapes.cpp compares pa2-i2-level-w1-short-pooc whole again, rows 1-5 (was its first cycle, rows 1-2): 288 checks, 3 fail on bc5f7a21, 82 on the base. Release floor 682 -> 683 (+1 test_pooc_limit_close_tapes, source-bound; the ci_verify.py:359 citations in CONTRIBUTING.md and docs/pages/contributing-llm.md follow the line). No hash witness moves beyond the lane's earlier commits. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit 1550a694e859e7606bee7fad6081fe54594a4307) INT27 pick note: the adapter and test hunks applied unchanged (each file's patch is byte-identical to the lane's). tests/CMakeLists.txt: git's clean merge closed H-MEASURE's fixture list after MAG-INTRABAR's row and left this lane's row outside it; the list is closed once, with both rows inside. The floors are the earlier picks' plus this row: release 710, PR registration 691/691/700 (ci_verify.py, its self-test pin and docs/ci.md). The design page's close-pass paragraph keeps both insertions -- this lane's limit sentence, then INT26 round 2's re-entry bracket sentences; the other docs conflicts were citation digits, merged token by token. The lane's b65cee22 (its hash re-pin) is not picked: its behaviour half follows, and its hash values fold into the single INT27 v19 hash re-pin.
1 parent e5efd18 commit 9dc3fc0

27 files changed

Lines changed: 774 additions & 43 deletions

‎CONTRIBUTING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ What each gate refuses:
153153

154154
`ci_verify.py` counts the CTest rows that actually **ran** and fails below a
155155
floor — `KERNEL_MIN_TESTS` ci_verify.py:250 and `RELEASE_MIN_TESTS`
156-
ci_verify.py:374.
156+
ci_verify.py:357.
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/ci.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,12 @@ requires the rows that actually ran to equal the second count, and records
102102
`registered`, `labelled = registered - selected`, and `ran` in
103103
`ctest-exclusion.log` and `ci-summary.json`. A skip, missing executable, lost
104104
registration below the PR registration floor, unreadable enumeration, or
105-
missing label fails. The PR registration floors at INT27 are 690 for Debug
106-
and sanitizers and 699 for native (653 and 662 at the INT24 base, plus wave G's
105+
missing label fails. The PR registration floors at INT27 are 691 for Debug
106+
and sanitizers and 700 for native (653 and 662 at the INT24 base, plus wave G's
107107
six rows, wave H's twenty-four, INT26's own tape row, the K-RUNERR, PERF-ZONED
108-
and TV-DEFAULTS rows and MAG-INTRABAR's three). The full-run release and
109-
kernel floors are 709 and 288 rows that ran; full runs do not exclude a label.
108+
and TV-DEFAULTS rows, MAG-INTRABAR's three and PAR-ORDERS-3's). The full-run
109+
release and kernel floors are 710 and 288 rows that ran; full runs do not
110+
exclude a label.
110111

111112
Preflight also runs the detached-comment census of the kernel compile closure
112113
(`detached-comments`: `scripts/measure_detached_comments.py --check-ceiling`)

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

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

‎docs/pages/contributing-llm.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ finding to report, not a step to take.
118118

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

124124
## The recipe for a lane
@@ -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:250, `RELEASE_MIN_TESTS` ci_verify.py:374). It
267+
(`KERNEL_MIN_TESTS` ci_verify.py:250, `RELEASE_MIN_TESTS` ci_verify.py:357). 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

‎scripts/ci_verify.py‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,10 @@
415415
# +1 MAG-INTRABAR test_magnifier_tradingview_intrabars (the table, the
416416
# grid and the ownership of TradingView's intrabars)
417417
# +1 MAG-INTRABAR test_adapter_magnifier_intrabar_tapes (TradingView's tapes)
418-
RELEASE_MIN_TESTS = 709
418+
# 710 = those 709 plus lane PAR-ORDERS-3's source-bound tape row:
419+
# +1 PAR-ORDERS-3 test_pooc_limit_close_tapes (a process_orders_on_close
420+
# limit entry at the close that placed it)
421+
RELEASE_MIN_TESTS = 710
419422
# ADR-0001 ruled-count floors, beside the ctest floors (R5 lane H-DOCGATES,
420423
# AUDIT4-opus X13 / docs-a N7). check_kernel_residuals.py counts the rulings
421424
# its vocabulary reads -- 174 identifiers and 45 texts on the lane's tree: the
@@ -440,11 +443,11 @@
440443
# at INT26, each with wave H's twenty-four rows of RELEASE_MIN_TESTS
441444
# (H-MEASURE +12, H-DOCGATES +3, K-OCA-KEEP +1, PAR-ORDERS-2 +4, PAR-MARGIN
442445
# +1, PAR-MARGIN-2 +1, PERF-KEDGE +1, PAR-CASHFEE +1), counted the same way;
443-
# 684/684/693 with INT26 round 2's tape row; 690/690/699 with lane
444-
# K-RUNERR's, lane PERF-ZONED's and lane TV-DEFAULTS' rows (+1 each) and
445-
# lane MAG-INTRABAR's three (+3).
446+
# 684/684/693 with INT26 round 2's tape row; 691/691/700 with lane
447+
# K-RUNERR's, lane PERF-ZONED's and lane TV-DEFAULTS' rows (+1 each), lane
448+
# MAG-INTRABAR's three (+3) and lane PAR-ORDERS-3's (+1).
446449
# An excluded run must still discover at least this many rows before -LE.
447-
EXCLUDED_REGISTERED_MIN = {'debug': 690, 'sanitizers': 690, 'native': 699}
450+
EXCLUDED_REGISTERED_MIN = {'debug': 691, 'sanitizers': 691, 'native': 700}
448451
# The ctest stage's bound. A full sanitizers run (push to main, a manual
449452
# dispatch, the maintainers' verification) ran out of its 30 minutes twice on
450453
# main's four-core runner before every row had finished, so it gets an hour; a

‎scripts/test_ci_verify.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,7 @@ def test_ctest_label_exclusion_is_forwarded(self):
13311331

13321332
def test_pr_exclusion_proves_registered_minus_labelled_equals_ran(self):
13331333
self.assertEqual(ci_verify.EXCLUDED_REGISTERED_MIN,
1334-
{'debug': 690, 'sanitizers': 690, 'native': 699})
1334+
{'debug': 691, 'sanitizers': 691, 'native': 700})
13351335
for profile, registered in ci_verify.EXCLUDED_REGISTERED_MIN.items():
13361336
with self.subTest(profile=profile):
13371337
code, summary, scripted, _ = self.run_profile(

‎src/source/pine_adapter.cpp‎

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16407,11 +16407,16 @@ void PineExecutionAdapter::flush_pooc_marketable_limit_entry_fills(
1640716407
// pine_fills.cpp:8022-8043 (evaluate_fill_price): under
1640816408
// process_orders_on_close, a pure LIMIT entry (no stop, no trail) placed by
1640916409
// this bar's source calc is evaluated in the post-calculation fill pass
16410-
// (pine_scheduler.cpp:259 step 4) against THIS bar's close. When the close
16411-
// is on the marketable side of the limit it fills there, limit-or-better,
16412-
// at bar_fill_price(bar.close) with no slippage; otherwise it rests and
16413-
// gets the ordinary touch evaluation from the next bar on. Scoped to the
16414-
// ordinary (non-COOF, non-stream) route and a flat book.
16410+
// (pine_scheduler.cpp:259 step 4) against THIS bar's close. When the
16411+
// close's tick is on the marketable side of the limit, or on it, it fills
16412+
// there, limit-or-better, at bar_fill_price(bar.close) with no slippage;
16413+
// otherwise it rests and gets the ordinary touch evaluation from the next
16414+
// bar on, however far the bar's range reached. TradingView reads the
16415+
// close's tick, not the raw close (a sell limit at 11.76 over a raw 11.755
16416+
// close fills at that close; a buy limit at 11.65 over 11.655, whose tick
16417+
// is 11.66, rests), with or without calc_on_order_fills (lab tv
16418+
// pa3-f3-pooc-limit-{long,short}{,-coof}; R5 lane PAR-ORDERS-3). Scoped
16419+
// to the non-stream route and a flat book.
1641516420
// A pure STOP entry the close already reached fills there too, with or
1641616421
// without calc_on_order_fills (R5 lane PAR-ORDERS): TradingView books it
1641716422
// at that bar's close, the close's tick slipped like any stop fill, on
@@ -16460,8 +16465,7 @@ void PineExecutionAdapter::fill_pooc_close_entries(
1646016465
if (row.family != PineOrderFamily::Entry || !row.opening) continue;
1646116466
if (row.birth.from_fill()) continue;
1646216467
if (row.projection_created_bar != projection_bar_index(context)) continue;
16463-
const bool pure_limit = !config_.calc_on_order_fills
16464-
&& finite_positive(row.exit_levels.limit)
16468+
const bool pure_limit = finite_positive(row.exit_levels.limit)
1646516469
&& !std::isfinite(row.exit_levels.stop);
1646616470
const bool pure_stop = finite_positive(row.exit_levels.stop)
1646716471
&& !std::isfinite(row.exit_levels.limit);
@@ -16477,12 +16481,11 @@ void PineExecutionAdapter::fill_pooc_close_entries(
1647716481
if (placed_flat ? (after_close || book_before != 0.0) : !reversing_stop) continue;
1647816482
if (row.direction_gate || row.paired_flat_market_candidate) continue;
1647916483
if (row.terms_priced_reverse && !reversing_stop) continue;
16480-
const bool at_close = pure_limit
16481-
? (row.is_long ? raw_close <= row.exit_levels.limit
16482-
: raw_close >= row.exit_levels.limit)
16483-
: (finite_positive(close_tick)
16484-
&& (row.is_long ? close_tick >= row.exit_levels.stop
16485-
: close_tick <= row.exit_levels.stop));
16484+
const bool at_close = finite_positive(close_tick) && (pure_limit
16485+
? (row.is_long ? close_tick <= row.exit_levels.limit
16486+
: close_tick >= row.exit_levels.limit)
16487+
: (row.is_long ? close_tick >= row.exit_levels.stop
16488+
: close_tick <= row.exit_levels.stop));
1648616489
if (at_close) marketable.emplace_back(handle, row);
1648716490
}
1648816491
if (marketable.size() > 1) {

‎tests/CMakeLists.txt‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1432,6 +1432,9 @@ list(APPEND TEST_SOURCES test_magnifier_tradingview_intrabars)
14321432
# tapes and calc_on_order_fills refill cascades replayed through the adapter.
14331433
# Source-bound.
14341434
list(APPEND TEST_SOURCES test_adapter_magnifier_intrabar_tapes)
1435+
# R5 lane PAR-ORDERS-3: a process_orders_on_close limit entry at the close that
1436+
# placed it (TradingView's tapes, tests/fixtures/pooc_limit_close). Source-bound.
1437+
list(APPEND TEST_SOURCES test_pooc_limit_close_tapes)
14351438

14361439
# R4-D L4b-fix restores every removed ShortSeed, affordability, sizing and
14371440
# deferred-close oracle as an individually compiled native-route twin. Keep
@@ -2179,7 +2182,9 @@ foreach(_pf_hm_row IN ITEMS
21792182
"test_second_extreme_order_tapes|PINEFORGE_PA2_SECOND_EXTREME_FIXTURE_DIR|second_extreme_orders"
21802183
"test_pooc_reversing_stop_tapes|PINEFORGE_PA2_REVERSING_STOP_FIXTURE_DIR|pooc_reversing_stop"
21812184
# R5 lane MAG-INTRABAR's tape row.
2182-
"test_adapter_magnifier_intrabar_tapes|PINEFORGE_MI_FIXTURE_DIR|magnifier_intrabars")
2185+
"test_adapter_magnifier_intrabar_tapes|PINEFORGE_MI_FIXTURE_DIR|magnifier_intrabars"
2186+
# R5 lane PAR-ORDERS-3's tape row.
2187+
"test_pooc_limit_close_tapes|PINEFORGE_PA3_POOC_LIMIT_FIXTURE_DIR|pooc_limit_close")
21832188
string(REPLACE "|" ";" _pf_hm_fields "${_pf_hm_row}")
21842189
list(GET _pf_hm_fields 0 _pf_hm_target)
21852190
list(GET _pf_hm_fields 1 _pf_hm_macro)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# process_orders_on_close limit close tapes (R5 lane PAR-ORDERS-3, finding 3)
2+
3+
TradingView's own trades for a limit entry a `process_orders_on_close` script places at a
4+
bar's close calculation, flat, at a level that bar's close tick or its range reaches; the
5+
entry is cancelled and the book closed on bar j+2. Sell limits: bar 22 (close 11.755, high
6+
11.755) at 11.76; bar 27 (close 11.845, high 11.95) at 11.86; bar 31 (close 11.855, high
7+
11.87) at 11.86; bar 49 (close 11.595, high 11.625) at 11.61. Buy limits: bar 13 (close
8+
11.655, low 11.655) at 11.65; bar 23 (close 11.745, low 11.745) at 11.74; bar 38 (close
9+
11.805, low 11.79) at 11.79; bar 46 (close 11.62, low 11.61) at 11.61. TradingView fills
10+
bars 22 and 31 at their close -- the close's tick, 11.76 / 11.86, reaches the limit -- and
11+
every other entry on the next bar, with and without `calc_on_order_fills`.
12+
`tests/test_pooc_limit_close_tapes.cpp` replays each tape through the Pine adapter on the
13+
15m chart.
14+
15+
Each directory is one `lab tv` export (pineforge-workflow, channel `ws-report-v1`,
16+
`rangeProof: covered`, NYSE:F 15, window 2025-07-01 .. 2025-07-08), byte-identical:
17+
`strategy.pine`, `tv_trades.csv` (times UTC+8), `meta.json`, `metrics.json`. The
18+
scripts count chart bars from 2025-07-02 09:30 ET, the first bar of
19+
`tests/fixtures/session_islastbar/bars.inc`, whose 15m bars the rows replay.
20+
21+
| probe | variant | trades | tvTradesSha256 | note |
22+
|---|---|---|---|---|
23+
| `pa3-f3-pooc-limit-long` | buy limits, process_orders_on_close | 4 | `82248d1f8a801e970fdb2d369ec4c6ec63f885ad6682db4b2e5eabffdd7b61c4` | `tv-tape-pa3-f3-pooc-limit-long-82248d1f` |
24+
| `pa3-f3-pooc-limit-long-coof` | the same, calc_on_order_fills | 4 | `82248d1f8a801e970fdb2d369ec4c6ec63f885ad6682db4b2e5eabffdd7b61c4` | `tv-tape-pa3-f3-pooc-limit-long-coof-82248d1f` |
25+
| `pa3-f3-pooc-limit-short` | sell limits, process_orders_on_close | 4 | `5590f99e59826d8983e5220f89871077ea6d4c624330c2c4e713e8e3686ffa1f` | `tv-tape-pa3-f3-pooc-limit-short-5590f99e` |
26+
| `pa3-f3-pooc-limit-short-coof` | the same, calc_on_order_fills | 4 | `5590f99e59826d8983e5220f89871077ea6d4c624330c2c4e713e8e3686ffa1f` | `tv-tape-pa3-f3-pooc-limit-short-coof-5590f99e` |
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"title": "PA3 F3 pooc-limit long coof",
3+
"slug": "pa3-f3-pooc-limit-long-coof",
4+
"source": "pineforge-workflow campaign lab tv",
5+
"channel": "ws-report-v1",
6+
"exportedAt": "2026-09-26T03:47:05.844Z",
7+
"chart": {
8+
"symbol": "NYSE:F",
9+
"interval": "15",
10+
"from": "2025-07-01",
11+
"to": "2025-07-08"
12+
},
13+
"pine_sha256": "ff351472fd390bde57c15fdff45b5315ffe7cd8b906a946470403e230325bbe1",
14+
"tv_trades_sha256": "82248d1f8a801e970fdb2d369ec4c6ec63f885ad6682db4b2e5eabffdd7b61c4",
15+
"tv_trades_rows": 8
16+
}

0 commit comments

Comments
 (0)