Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ version number follows semantic versioning over the surfaces the

## Unreleased

- Corrected the parity grading for the historical population reported in [#836](https://github.com/pineforge-4pass/pineforge-engine/issues/836) on 2026-11-11: counting unmatched trades net instead of gross overstated the excellent tier by 10 of 312 reference probes (311 instead of 301) and by 24 of 7,989 graded probes. The trade data is unchanged. Measured on 2026-11-19 on the pinned reference corpus (93d956a2): 303 excellent and 8 strong with one declared anomaly, where the net count gave 311 excellent and 0 strong; all 312 pinned trade outputs still match their baseline hashes.
- The corpus grader counts every unmatched gated trade on either side as a gross mismatch. One engine-only trade and one TradingView-only trade count as two mismatches, so equal list sizes cannot satisfy the excellent count gate. The same gross count, divided by the larger gated trade count (zero for two empty pools), supplies the percentage for strong-tier grading and fragmented-FIFO eligibility; thresholds are unchanged (#836).

## 1.14.0 — 2026-11-20

- The engine layout stamp that `pineforge-live` checks, `PF_STREAM_ENGINE_LAYOUT_VERSION`, is now 5. A strategy module built against 1.13.x headers declares stamp 4 and is refused by a 1.14.0 `pineforge-live` before it is created (`strategy engine layout mismatch: module=4 runtime=5`): rebuild such modules against the matching 1.14.0 headers. The earlier miss, disclosed: 1.13.0 changed the same internal layout without raising the stamp, so a module built against 1.12.x headers and loaded into a 1.13.x `pineforge-live` was not refused; rebuild such modules against matching headers too. `PF_ABI_VERSION` stays 5, and the C API and its caller-allocated structures are unchanged.
- A new host helper, `strategy_convert_identity_or_warn`, lets generated code report `strategy.convert_to_account` and `strategy.convert_to_symbol` calls that had no account-currency rate: the value still comes back unchanged, and the run's warnings now list `currency_conversion_rate_unavailable` once for each such call site (#376).
- On a chart aggregated from a lower timeframe, an order that a fill places or replaces at the bar's open now starts working at that fill, as it does on the plain chart: for example the exits of an entry that fills there, or the exits a pyramiding add re-arms. Before, such an order started at the bar's close, so an exit that the same bar crosses after its open could fill on a later bar or point, and the trade's drawdown and run-up could differ from the plain chart's. This affects confirmed runs on aggregated charts whose entries or adds place or replace orders when they fill; plain charts and every other path are unchanged.
Expand Down Expand Up @@ -287,7 +292,7 @@ version number follows semantic versioning over the surfaces the
- `strategy_pending_order_fill_qty` reported a wrong `close_only` for some entries: 1 where the fill opens or reverses the position (a market entry followed by a priced stop on the same bar and a short-seed percent entry, #905; a pyramiding entry after a same-bar close; an entry probed inside the callback that queued it) and 0 where the fill only closes (a priced entry that replaced a same-id market order, a frozen reversal, whose reported quantity is now the frozen transaction, and a host-sized `strategy.order` against an opposite position). It now applies the fill's prior-cycle rule and shape rules for these cases. A `strategy.order` with its own quantity against an opposite position now reports the quantity its fill transacts, and `close_only` 1 exactly when that fill opens nothing. While a close the script placed on the same bar is still waiting to fill ahead of the order, the report instead gives the quantity as written, with `close_only` 0, or 1 when the order is in an OCA cancel group. That answer can differ from the fill: in an OCA cancel group it says `close_only` 1 although the fill opens if the close leaves the position flat; otherwise it says `close_only` 0 although the fill only closes if the close leaves a position at least as large as what the order transacts; and the fill can transact less than the quantity as written, for example when the quantity is floored to the quantity step, or when an OCA cancel-group order closes no more than the close leaves. The report is made before the fill and does not account for checks the fill makes at fill time against equity, price and margin (for example, an entry the account cannot afford in whole units). In those cases the fill can differ from the report. Not modelled: fill-time money guards (whole-lot tie, low-value or fractional lot), affordability, margin-call surplus, the close quantity a reversal keeps when a margin call was booked after the script, a refused signal price, an admission refusal, earlier fills of the same pass, and an entry that names its own quantity or a row whose request cannot be read, such as a row held in the source's shadow queue (judged by the prior-cycle rule alone). Fills are unchanged. (#905, #910)
- The C header and docs documented partition 2 for a pure percent-of-equity stop; the engine returns 1 (measured on 1.13.0). The documentation now matches the returned value; behaviour and ABI are unchanged.

## 1.13.0
## 1.13.0 — 2026-11-18

### Changed

Expand Down
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ the affected scripts and how to recognise it.

An `engineErrors` entry (the "engine errors" count above) is not always an engine failure: it can also be a probe that was not graded because its reference data is incomplete. Release 1.13.0 records one such entry, the open corpus probe `validation/ta-stochastic-rsi-cross-01`.

Known issue ([#836](https://github.com/pineforge-4pass/pineforge-engine/issues/836)): the parity scoreboard counts unmatched trades net instead of gross, so a probe with one engine-only and one TradingView-only trade still grades excellent; counted gross, 24 of the 7,989 graded probes (7,959 excellent and 30 strong instead of 7,983 and 6) and 10 of the 312 open reference probes (301 excellent instead of 311) grade one tier lower, with no trade list changed, and the corrected grader is planned for a release after 1.14.0.
The historical gross-count regrade recorded in [#836](https://github.com/pineforge-4pass/pineforge-engine/issues/836) measured **7,959 excellent / 30 strong**: 24 probes moved from excellent to strong and none lower. That regrade and the dated scoreboard above describe their recorded pair and population; they are not a fresh measurement of this revision. The grader uses gross counting. Recorded release results remain historical measurements.

Release **1.4.0 (2026-10-08)** maps to **<!-- pf:releases[1.4.0].scoreboard.excellent|int -->7,983<!-- /pf --> excellent / <!-- pf:releases[1.4.0].scoreboard.strong|int -->6<!-- /pf --> strong** on <!-- pf:releases[1.4.0].scoreboard.graded|int -->7,989<!-- /pf --> graded probes (baseline <!-- pf:releases[1.4.0].scoreboard.id|code -->`pineforge-parity-baseline-20261007-engine-b3192bfc`<!-- /pf -->, promoted <!-- pf:releases[1.4.0].scoreboard.date -->2026-10-07<!-- /pf --> UTC), with <!-- pf:releases[1.4.0].scoreboard.belowStrong|int -->0<!-- /pf --> below strong and <!-- pf:releases[1.4.0].scoreboard.engineErrors|int -->0<!-- /pf --> engine errors. These are recorded grading outcomes for that pair and population.

Expand All @@ -316,9 +316,11 @@ The quantities above render from the public [facts tokens](https://github.com/pi

| Board | Test set | Result |
|---|---|---|
| **Public** — [open corpus](https://github.com/pineforge-4pass/pineforge-corpus) | 312 reference strategies on BINANCE:ETHUSDT.P 15m, Apache-2.0, reproducible by anyone | this repository's sweep of the v1.0.1 library: **311 excellent + 1 declared anomaly**; the <!-- pf:scoreboard.corpusProbes\|int -->309<!-- /pf --> of them in the measured population: **<!-- pf:scoreboard.scopes.corpus.excellent\|int -->309<!-- /pf --> excellent** |
| **Public** — [open corpus](https://github.com/pineforge-4pass/pineforge-corpus) | 312 reference strategies on BINANCE:ETHUSDT.P 15m, Apache-2.0, reproducible by anyone | reference sweep **2026-11-19** ([#836](https://github.com/pineforge-4pass/pineforge-engine/issues/836), [#883](https://github.com/pineforge-4pass/pineforge-engine/issues/883)): **303 excellent + 8 strong + 1 declared anomaly**; the <!-- pf:scoreboard.corpusProbes\|int -->309<!-- /pf --> of them in the dated scoreboard above: **<!-- pf:scoreboard.scopes.corpus.excellent\|int -->309<!-- /pf --> excellent** |
| **Closed test** | <!-- pf:inventory.closedProbes\|int -->7,680<!-- /pf --> probes of <!-- pf:inventory.closedScripts\|int -->741<!-- /pf --> TradingView scripts across the <!-- pf:scoreboard.lanes\|int -->18<!-- /pf --> lanes: <!-- pf:inventory.communityScripts\|int -->680<!-- /pf --> community-shared scripts (<!-- pf:inventory.communityProbes\|int -->7,179<!-- /pf --> probes), private under TradingView's Terms of Service, and <!-- pf:inventory.probeScripts\|int -->61<!-- /pf --> probe scripts the maintainers wrote (<!-- pf:inventory.probeScriptProbes\|int -->501<!-- /pf --> probes) | **<!-- pf:scoreboard.scopes.closed.excellent\|int -->7,674<!-- /pf --> excellent + <!-- pf:scoreboard.scopes.closed.strong\|int -->6<!-- /pf --> strong** |

Aggregate reference verification (`scripts/verify_corpus.py --all`) has no per-strategy exception ([#836](https://github.com/pineforge-4pass/pineforge-engine/issues/836)): it exits 1 and lists every strategy graded below Strong or missing an input, unless the strategy declares an anomaly or engine-only outcome. This reference measurement is separate from the dated scoreboard metadata above; baseline promotion requires its own verification.

### Lane by lane

<!-- pf:scoreboard|lanes-all -->
Expand All @@ -340,10 +342,19 @@ The hard lane combines <!-- pf:scoreboard.hardLane.corpusProbes|int -->309<!-- /

Every script is exported from TradingView as-is (its own inputs, its own defaults) with the chart's trade list at full precision, transpiled with [`pineforge-codegen`](https://github.com/pineforge-4pass/pineforge-codegen-oss), and run by this engine on the same OHLCV bars. The two trade lists are aligned trade-for-trade and graded by [`scripts/verify_corpus.py`](scripts/verify_corpus.py):

- **excellent** — the same number of trades, ≥ 99% of TradingView's trades matched, the distinct-entry identity check passed, entry and exit prices within 0.01% and PnL within 1% at the 90th percentile (trailing-stop scripts are graded on the *production* profile: exits within 0.02% and PnL within 1%, since a trail fill depends on TradingView's sub-bar path);
- **strong** — ≥ 95% matched, trade count within 6%, entries within 0.1% and exits within 0.5% at p90;
- **excellent** — zero unmatched gated trades on either side, ≥ 99% of TradingView's trades matched, the distinct-entry identity check passed, entry and exit prices within 0.01% and PnL within 1% at the 90th percentile (trailing-stop scripts are graded on the *production* profile: exits within 0.02% and PnL within 1%, since a trail fill depends on TradingView's sub-bar path);
- **strong** — ≥ 95% matched, gross unmatched trades below 6% of the larger gated trade count, entries within 0.1% and exits within 0.5% at p90;
- **moderate** — ≥ 75% coverage with ≥ 90% of the in-window trades matched; **weak** — at least one match; **minimal** — none.

The absolute mismatch metric, `count_abs_delta` (printed as `abs`), adds every
unmatched gated TradingView trade and every unmatched gated engine trade.
The separate `net_count_abs_delta` (`net`) reports the difference in list sizes
for diagnostics only.
Excellent requires the absolute mismatch count to be zero. The percentage
metric, `count_delta`, divides that same gross count by the larger gated trade
count, with zero for two empty pools. Strong-tier grading and fragmented-FIFO
metric eligibility use this same percentage and retain their thresholds.

The closed-test grades are the maintainers' own measurement of a fixed population; only the public board can be re-run from this repository.

### Distinct-entry identity
Expand Down
4 changes: 2 additions & 2 deletions docs/ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ gates:
differ from the pinned corpus tape.
2. **Tiers.** `scripts/verify_corpus.py --all --quiet` must still print its
pinned headline, currently
`Verified 312 strategies — excellent=311, strong=0, moderate=0, weak=0, minimal=0, anomaly=1, engine_only=0, missing=0`.
`Verified 312 strategies — excellent=303, strong=8, moderate=0, weak=0, minimal=0, anomaly=1, engine_only=0, missing=0`.

Both always run, so one command reports both. Exit 0 is parity, 1 is drift, 2
is "the check could not run" (no gitlink, wrong corpus commit, modified pinned
Expand Down Expand Up @@ -1042,7 +1042,7 @@ column declared in `ALLOWED_EXTRA_COLUMNS`. An undeclared column is drift.

The two gates are not redundant. A one-tick slippage change on a single probe
moves its trades and its baseline hash while `verify_corpus.py` still reports
`excellent=311, strong=0, anomaly=1`: the tier verifier grades against the
`excellent=303, strong=8, moderate=0, anomaly=1`: the tier verifier grades against the
TradingView tape with tolerances, so it cannot see a regression that stays
inside them. The baseline can.

Expand Down
11 changes: 7 additions & 4 deletions scripts/check_corpus_parity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,13 @@ DIFF_LINES="${DIFF_LINES:-20}"
SUBSET_FILE="${SUBSET_FILE:-scripts/corpus_parity_subset.txt}"
PY="${PYTHON:-python3}"

# The parity headline this engine is pinned to. Moving it is a deliberate act:
# it means the corpus gitlink moved, and the commit that moves it carries the
# evidence. scripts/verify_corpus.py prints this line verbatim.
EXPECTED_VERIFY="${EXPECTED_VERIFY:-Verified 312 strategies — excellent=311, strong=0, moderate=0, weak=0, minimal=0, anomaly=1, engine_only=0, missing=0}"
# The parity headline this engine is pinned to; changes require measured evidence.
# expectation corrected: excellent=311, strong=0 -> excellent=303, strong=8,
# because the excellent-only rule requires zero gross unmatched TV + engine
# trades (#836); measured 2026-11-19 on corpus 93d956a2, and all 312 pinned
# strategy trade outputs still match the baseline hashes.
# scripts/verify_corpus.py prints this line verbatim.
EXPECTED_VERIFY="${EXPECTED_VERIFY:-Verified 312 strategies — excellent=303, strong=8, moderate=0, weak=0, minimal=0, anomaly=1, engine_only=0, missing=0}"

log() { printf '\033[1;34m[corpus-parity]\033[0m %s\n' "$*"; }
warn() { printf '\033[1;33m[corpus-parity]\033[0m %s\n' "$*" >&2; }
Expand Down
Loading
Loading