Skip to content

fix: reset compiled script runs and align MFI source direction - #223

Merged
luisleo526 merged 7 commits into
mainfrom
campaign/r37-mfi-direction
Sep 9, 2026
Merged

luisleo526 merged 7 commits into
mainfrom
campaign/r37-mfi-direction

Conversation

@luisleo526

Copy link
Copy Markdown
Collaborator

Reusing a compiled strategy handle could retain Pine series, indicator and collection state across backtests. Add an engine-owned preparation hook after broker reset and before precalculation/security evaluation, and reset run-local allocation counters and cached broker snapshots. The companion codegen change resets generated persistent members through that hook. Configured inputs survive a new run, while ticks and order-fill recalculations within one stream retain their state.

MFI also classified equal-decimal source values by raw binary comparison, allowing a tiny HLC3 rounding residue to contribute a full bar's money flow. Use the existing Pine float-comparison helpers for direction. Direct TradingView controls distinguish below-band and above-band movements at three price scales. The fixes have no strategy, symbol or date lookup.

Addresses engine issue #219. This pair requires regenerated strategy C++ and rebuilt modules against matching engine headers/library; the internal C++ namespace prevents stale objects from silently binding the changed virtual layout. The public C ABI is unchanged. Companion codegen commit: c8ffe587c8fb82435fec34121a93fab2b7018924.

Validation:

  • Final Cloud sweep cand-r37-full-b-20260909: 72/72 cases, 4,190/4,190 probes; 4,180 excellent / 10 strong / 0 moderate, up one excellent from Round 36. The README-inclusive pair reproduces the first full sweep's grades, quantities and trade CSVs exactly.
  • Ford 15m RSI/MFI becomes excellent: canonical match 95.2% to 100%, count gap 2 to 0. EURUSD MFI and Ford EWO remain excellent and reach 100% canonical match.
  • All 704 hard probes retain identical grades, quantity metrics and trade CSVs; 4,187/4,190 CSVs are unchanged. No verifier, grading, threshold, profile, feed, reference, input or population changes.
  • Independent raw audit: 315/315 strict entry-and-exit matches across the three changed probes, 13 gained and none lost. Overall verifier matches 2,817,481 of 2,819,967 TradingView trades.
  • Real retained-C-handle Cloud diagnostics on fixed 5,000-bar windows: Cashflow 42/41/41 becomes 42/42/42; CHoCH/BOS 133/134/134 becomes 133/133/133. SMA152 stays at 232 trades with repeated-run hashes now equal. Fresh controls agree; these are current windows, not the reporter's older counts.
  • Full native build: 249/249 checks. Full codegen suite with candidate engine headers/library: 2,802 passed, 1 pre-existing skip. Permanent compiled C-ABI tests cover repeated/short batches, input A-B-A, stream restart/continuity and mutable collections/UDTs with order-fill recalculation. New literal MFI controls fail on the old source (17 failures) and pass all 157 checks on the candidate.
  • Independent Grok 4.6 high review of the exact final engine/codegen pair: zero actionable P0/P1/P2 findings. Runtime and tests are unchanged from the fully tested pair; only README documentation was added before the final Cloud sweep.

Known limits: the EURUSD open-position mark retains its pre-existing price difference, and CSV display-precision differences remain. Exact MFI behavior at the inclusive 1e-10 boundary is inherited from the existing TV-pinned generic helper; the new direct MFI controls bracket that boundary. No all-column or byte-for-byte reporting equality is claimed.

Cloud PR gate pineforge-pr-gate-xh6xb: PASS, target score +1, hard regressions 0, tolerated exceptions empty, full 4,190-probe coverage. Verdict recorded and corroborated in Postgres for engine 0d152028f540bf48242ea190cf33144756ba6b40 and codegen c8ffe587c8fb82435fec34121a93fab2b7018924. Candidate snapshot 8bd08fd50eb8b1785ad364dd7759e9a5e4b0625e9f3b2c13e64816d77788d52c (788,836 bytes), unchanged population 3d72f815de54e4a2f6fdff6bb2294ea99c38849888390ded4ecd68ac3e5a9110. Independent final audit verifies all 72 immutable case/input manifests, source bundles, 64/64 runner tasks and successful pipeline completion. Both companion PRs must merge before the composite baseline promotion.

@luisleo526
luisleo526 merged commit 0d15202 into main Sep 9, 2026
8 checks passed
@luisleo526
luisleo526 deleted the campaign/r37-mfi-direction branch October 5, 2026 02:42
luisleo526 added a commit that referenced this pull request Oct 20, 2026
#223 landed (#443)

Only the six `uses:` lines change. Floating tags become the full SHAs and exact
release comments codegen-oss main carries since #223 (851290925):
actions/checkout v4 -> 3d3c42e5... # v7.0.1 (two steps), actions/setup-node
v4 -> 949feb24... # v7.1.0, google-github-actions/auth v2 -> 7c6bc770...
# v3.0.0, google-github-actions/setup-gcloud v2 -> aa5489c8... # v3.0.1, and
actions/create-github-app-token v1 -> d72941d7... # v1.12.0 (the SHA the
template and codegen copies already pin; this step is credentialed and its
major is deliberately not moved here, as in codegen).

Nothing else in the file is touched: no runs-on, permissions, secrets, trigger,
input or script line. This copy still differs from codegen's in its gate logic
and its cloud-sql-proxy loop (not part of this change).

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant