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 0501468
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -230,11 +230,11 @@ TradingView ties some day-boundary logic (intraday order caps, session rollovers
230
230
|`pf_version_get` / `pf_version_string` / `pf_abi_version`| Runtime version, version string, struct-layout version (`PF_ABI_VERSION == 4`) |
231
231
|`strategy_request_abort` / `strategy_last_run_status`| Cooperative abort of a run in progress; `0`=completed, `1`=aborted |
232
232
|`strategy_set_realtime_tail`| Live-runtime surface (ABI v4): the array's last bar is a still-forming tail — `barstate.islast=false`, `last_bar_index`/`last_bar_time` frozen at the horizon bar, no range-end row |
233
-
|`strategy_set_probe_suppress_tail_logic`| ABI v4: the last bar runs only the broker's pre-`on_bar` steps (pending-order settlement, intraday-cap/loss checks) and returns — no `on_bar`, no range-end/margin-call/bracket-reissue processing |
233
+
|`strategy_set_probe_suppress_tail_logic`| ABI v4: the last bar runs only the broker's pre-`on_bar` steps (pending-order settlement, intraday-cap/loss checks) and returns — no `on_bar`, no margin-call / POOC second pass / bracket-reissue processing (the range-end row is `strategy_set_realtime_tail`'s to skip; the flags are independent)|
234
234
|`strategy_set_path_order` / `strategy_last_bar_dual_entry_path`| ABI v4: force the intrabar O→H/L→C leg order (`AUTO`/`HIGH_FIRST`/`LOW_FIRST`) for path-dependent fill probing; read which side won a same-bar dual-entry-stop arbitration |
235
235
|`strategy_set_broker_state_hash_recording` / `strategy_broker_state_hash`| ABI v4: toggle a 64-bit broker-state hash appended per script bar to `pf_report_t::broker_state_hash`; read the final state's hash |
236
236
|`strategy_pending_orders_len` / `strategy_pending_order_get` / `strategy_pending_order_layout`| ABI v4: the resting pending-order book after the most recent run — count, a POD snapshot per order (`pf_pending_order_v1_t`), and the snapshot's self-describing field layout |
237
-
|`strategy_pending_order_fill_qty` / `_level_resolved` / `_effective_levels` / `strategy_trail_best_price`| ABI v4: engine-computed values for a resting order — the quantity it would fill at a given price, whether its relative offsets resolve yet, its resolved stop/limit/trail-activation levels, and the live position's trail extreme |
237
+
|`strategy_pending_order_fill_qty` / `_level_resolved` / `_effective_levels` / `strategy_trail_best_price`| ABI v4: engine-computed values for a resting order — the quantity it would open if filled at a given price, whether its relative offsets resolve yet, its resolved stop/limit/trail-activation levels, and the live position's trail extreme |
238
238
|`strategy_position_avg_price` / `strategy_position_cycle_seq` / `strategy_position_size`| ABI v4: the live position's volume-weighted average entry price, its cycle id, and its script-facing signed size |
239
239
|`strategy_closed_trade_entry_id` / `_exit_id` / `_exit_comment` / `_close_cause`| ABI v4: per-closed-trade id/comment strings and a `close_cause` enum (`SCRIPT`/`BRACKET`/`MARGIN_CALL`/`INTRADAY_LOSS_CAP`/`INTRADAY_FILL_CAP`/`RANGE_END`), indexed like `strategy_closed_trade_entry_incarnation`|
240
240
|`strategy_current_equity` / `strategy_script_bars_processed`| ABI v4: `initial_capital + netprofit` (not Pine's `strategy.equity`, which also adds open profit); total script bars dispatched by the most recent run |
-**v0.14.0** (2026-09-08) — ABI v4 live surface for `pineforge-live`: 24 new default-off exports (cooperative abort, realtime tail, probe-suppress tail logic, forced path order, a per-bar broker-state hash, the pending-order book as a generated POD mirror, closed-trade id/comment/close-cause, position and equity accessors). No flag changes a historical run: `scripts/live_flags_off_identity.py` (312 corpus probes, 0 differ vs the pre-v4 branch point), `scripts/live_flags_lane.py` (312 probes, 0 positives, 130 open-at-end trades subtracted), and `scripts/bar_identity_lane.py` (row 1: 222,295 bars compared, 2 explained open divergences, 0 else) all pass. 56 symbols.
276
+
-**Unreleased** (branch `live/abi-v4`) — ABI v4 live surface for `pineforge-live`: 24 new default-off exports (cooperative abort, realtime tail, probe-suppress tail logic, forced path order, a per-bar broker-state hash, the pending-order book as a generated POD mirror, closed-trade id/comment/close-cause, position and equity accessors). No flag changes a historical run: `scripts/live_flags_off_identity.py` (312 corpus probes, 0 differ vs the pre-v4 branch point), `scripts/live_flags_lane.py` (312 probes, 0 positives, 130 open-at-end trades subtracted), and `scripts/bar_identity_lane.py` (row 1: 222,295 bars compared, 2 explained open divergences, 0 else) all pass. 56 symbols.
277
277
-**v0.13.0** (2026-09-05) — the parity campaign, rounds 1–11: TradingView's broker rules pinned with sensor exports and landed with replay tests — ten-significant-digit money, trailing-stop restarts, zero-offset trails, declined-reversal bracket legs, the surviving `strategy.close`, sparse `ta.atr`/`ta.tr`, pivot tick snap, same-bar entry/close transactions, early-close higher-timeframe buckets, 64-bit epoch arrays. Closed test 3,880/3,881; corpus 309/309. ABI v3, 32 symbols, 198 tests.
278
278
-**v0.7 – v0.12** (June–August 2026) — native and auxiliary `request.security()` feeds, ABI v2 metrics + equity curve, streaming mode, range-end accounting. See [GitHub releases](https://github.com/pineforge-4pass/pineforge-engine/releases).
279
279
-**v0.6.0** — performance sprint: cached static inputs, thread-local timestamp caching, lazy timezone caching; up to 6.7M bars/s.
Copy file name to clipboardExpand all lines: docs/pages/live-surface.md
+18-9Lines changed: 18 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
**ABI v4** (`PF_ABI_VERSION == 4`) appends 24 exports and two `pf_report_t`
6
6
fields for `pineforge-live`, the recompute-based live runtime built on top
7
-
of this engine (see [pineforge-livedesign spec §3](https://github.com/pineforge-4pass/pineforge-workflow-live)
7
+
of this engine (see [`pineforge-workflow-live/docs/superpowers/specs/2026-09-07-pineforge-live-design.md` §3](https://github.com/pineforge-4pass/pineforge-workflow-live)
8
8
for the full contract this surface serves). Every one of the 24 symbols is
9
9
**default off / read-only** and **never changes a historical run**: the
10
10
four configuration setters below default to the pre-v4 behavior, and every
@@ -21,7 +21,7 @@ runtime works by *recomputing* it (see @ref streaming for why the
21
21
22
22
| Symbol | Purpose | Default | Changes history when off? |
23
23
| --- | --- | --- | --- |
24
-
|`strategy_request_abort`| Set a cooperative abort flag, consumed by the run in progress, checked at the top of both bar loops. | N/A — an action, not configuration; cleared at `run()` entry. | No |
24
+
|`strategy_request_abort`| Set a cooperative abort flag, consumed by the run in progress, checked at the top of every bar loop (the single-timeframe `run()` loop, `run_simple_bar_loop`, `run_aggregation_bar_loop`). | N/A — an action, not configuration; cleared at `run()` entry. | No |
25
25
|`strategy_last_run_status`|`0` completed, `1``NOT_COMPLETED` (aborted), `-1` if `s` is `NULL`. | N/A — read-only. | No |
26
26
|`strategy_set_realtime_tail`| Mark the array's last bar as a still-forming tail (§3.1 semantics below). | Off (`on == 0`). | No |
27
27
|`strategy_set_probe_suppress_tail_logic`| Run only the broker's pre-`on_bar` steps on the last bar and stop (§3.2 below). | Off (`on == 0`). | No |
@@ -32,9 +32,9 @@ runtime works by *recomputing* it (see @ref streaming for why the
32
32
|`strategy_pending_orders_len`| Count of orders resting in the pending-order book after the most recent `run()` — the book in force for the next bar. `0` if `s` is `NULL`. | N/A — read-only. | No |
33
33
|`strategy_pending_order_get`| Copy the *i*-th resting order into a `pf_pending_order_v1_t` snapshot (see [The pending-order mirror](#live_surface_pending_mirror)). | N/A — read-only. | No |
34
34
|`strategy_pending_order_layout`| The field table (`pf_field_desc_t[]`: name, type, offset, size) of `pf_pending_order_v1_t` as this runtime compiled it. Static storage, no handle needed. | N/A — static. | No |
35
-
|`strategy_pending_order_fill_qty`| The contracts the *i*-th resting order would open if filled at a given price, and which of 4 sizing rules (`EXPLICIT`/`FROZEN_PLACEMENT`/`DEFAULT_STOP_PLACEMENT`/`AT_FILL`) produced it, plus a `close_only` flag. | N/A — read-only. | No |
35
+
|`strategy_pending_order_fill_qty`| The contracts the *i*-th resting order would open if filled at a given price, and which of 4 sizing rules (`EXPLICIT`/`FROZEN_PLACEMENT`/`DEFAULT_STOP_PLACEMENT`/`AT_FILL`) produced it, plus a `close_only` flag. Returns `0` on success; `1` — with `qty` NaN, `close_only` 0, `partition` -1 — when the order is an EXIT (its fill qty is decided against the live position at the fill); `-1` with nothing written when `s` is `NULL`, `index` is out of range, or any out-pointer is `NULL`. | N/A — read-only. | No |
36
36
|`strategy_pending_order_level_resolved`|`1` when the *i*-th order's `from_entry`-relative offsets resolve now (entries/plain orders/empty-`from_entry` exits: always; a bound exit: only once that entry has filled in the current cycle). `-1` if `s` is `NULL` or `index` is out of range. | N/A — read-only. | No |
37
-
|`strategy_pending_order_effective_levels`| The *i*-th order's resolved `stop`/`limit`/`trail_activation` price levels, as the fill path resolves them. `NaN` for an unset/unresolvable leg. | N/A — read-only. | No |
37
+
|`strategy_pending_order_effective_levels`| The *i*-th order's resolved `stop`/`limit`/`trail_activation` price levels, as the fill path resolves them. `NaN` for an unset/unresolvable leg. Returns `0`; `-1` with nothing written under the same three conditions as `strategy_pending_order_fill_qty` (`s``NULL`, `index` out of range, or any out-pointer `NULL`). | N/A — read-only. | No |
38
38
|`strategy_trail_best_price`| The running trail extreme (`trail_best_price_`) the exit trail legs ride: high-since-fill for a long, low-since-fill for a short. `NaN` if `s` is `NULL` or no position has filled. | N/A — read-only. | No |
39
39
|`strategy_position_avg_price`| The live position's volume-weighted average entry price. `NaN` if `s` is `NULL` or the position is flat. | N/A — read-only. | No |
40
40
|`strategy_position_cycle_seq`| The live position's cycle id: `0` when flat, a fresh nonzero id per open/reversal, unchanged across same-direction adds. `-1` if `s` is `NULL`. | N/A — read-only. | No |
@@ -70,7 +70,8 @@ configuration**, not one-shot: it stays in effect until a caller passes
70
70
3.`bar_index` stays put; `last_bar_index` (and `last_bar_time`) are frozen
71
71
at the horizon bar (`horizon_bars - 1`), when `horizon_bars > 0`.
72
72
4. The range-end synthetic close row/trade is skipped (no `open_at_end`
73
-
row); the final equity point keeps `open_profit`.
73
+
row); the final equity point keeps `open_profit`, and the drawdown/runup
74
+
scalars are folded without the range-end row.
74
75
5. Interior bars (every bar before the last) are unaffected.
75
76
76
77
Default off (`on == 0`): every historical run stays byte-identical to
@@ -102,8 +103,14 @@ not coupled; set each explicitly.
102
103
Dispatch-path scope: honoured only on the standard `dispatch_bar` path (the
103
104
single-timeframe run loop and the `input_tf == script_tf` simple bar loop).
104
105
Silent no-op under `calc_on_order_fills` and under the bar magnifier —
105
-
both are gated features in v1 and a probe must not enable them. Clear this
106
-
flag before `strategy_stream_begin`; the warmup replay is a `run()`.
106
+
both are gated features in v1 and a probe must not enable them. On the
107
+
non-magnifier aggregation path (`input_tf < script_tf`) the semantics are
108
+
UNDEFINED until the partial-bucket forming-bar flag lands: callers must
109
+
feed an `input_tf == script_tf` array until that flag exists. Under
110
+
`process_orders_on_close`, the pre-script carried-position margin helpers
111
+
that `process_margin_call` would otherwise run are also skipped on the
112
+
suppressed last bar. Clear this flag before `strategy_stream_begin`; the
113
+
warmup replay is a `run()`.
107
114
108
115
Default off (`on == 0`): every historical run stays byte-identical to
109
116
before this flag existed.
@@ -154,8 +161,10 @@ existed.
154
161
155
162
`strategy_request_abort(s)` sets an atomic flag from any thread, consumed
156
163
by the run in progress and cleared at `run()` entry (a no-op when idle),
157
-
checked at the top of both bar loops. `strategy_last_run_status(s)` (an
158
-
append-only status accessor) reports whether the most recent run completed
164
+
checked at the top of every bar loop (the single-timeframe `run()` loop,
0 commit comments