SniperGold_ML/docs/SESSION_HANDOVER_2026-08-23_P3_S17R2_VECTORIZE.md

9.5 KiB

SESSION HANDOVER — P3-S.17R.2 VECTORIZE CHoCH / OB / FVG (FULL-SCOPE PARITY)

Date       : 2026-08-23
Session    : P3-S.17R.2 — Vectorize CHoCH / OB / FVG for Full-Scope
             Runtime <-> Research Parity
Status     : COMPLETE (officially closed)
Verdict    : FULL PARITY ACHIEVED
P3-S.18    : NOT STARTED (blocked; requires separate, explicit authorization)
Next       : NEW DECISION SESSION

A. Session

P3-S.17R.2 — Vectorize CHoCH / OB / FVG Full-Scope Parity
Final status  : COMPLETE
Final verdict : FULL PARITY ACHIEVED
CHoCH         : vectorized
OB            : vectorized
FVG           : vectorized

B. Starting Checkpoint

P3-S.17R.1 close checkpoint : 5cd1e7eed9cefbc91f6975de3cb9c1cda2755046
Verified at session start : local == origin/main, branch main, working tree
CLEAN, origin = https://forge.mql5.io/chiki2bum2/SniperGold_ML.git.
Authoritative handover read first :
  docs/SESSION_HANDOVER_2026-08-23_P3_S17R1_RESEARCH_SWEEP_GATE_REPAIR.md
(newest authoritative by commit ancestry; supersedes P3_S17R1.md).

C. Final Forge HEAD

Final Forge HEAD (verified) : 7cc8af6ab9047f565f883683721d0ee9d11a3342
  (docs: record P3_S17R2_FINAL_SHA ff3202c)

Meaningful P3-S.17R.2 parity-close commit :
  ff3202c8be59d9f1073b2f286e219c54f96eb44a

Verified conditions (close, pre-closing-commit):
  local HEAD == remote HEAD == 7cc8af6...
  branch                          = main
  working tree                    = CLEAN
  origin                          = https://forge.mql5.io/chiki2bum2/SniperGold_ML.git

D. CHoCH vectorization

Engine-2 CHoCH (fractal 2/2, newest-4 trend, close break) transcribed into a
vectorized numpy kernel:
  reference == vectorized : 197,032 / 197,032 exact
  dir / trend / newest-levels / events : 0 mismatches (22,798 onsets in feed)

Approach: pivot masks via neighbor comparisons, newest-pivot selection via
searchsorted/gather, per-bar event with latest-frames masks. Semantics
consumed by the F3 Candidate Setup chain reproduced identically.

E. OB vectorization

Order Block (opposite-color candle B before a strong-move candle M with
|body| >= 1.5x avg-body(20); zone = full B; CLOSE-THROUGH mitigation with
strict inequality, includes the move candle; partial-fill overlap stays
ACTIVE) fully vectorized:
  reference == current : 197,032 / 197,032 bars
  dir / formation / mit / bounds : 0 mismatches (196,628 active bars)

Bit-exact average-body arithmetic achieved by summing newest-first sequences
identically to the runtime (IEEE-754). Sliding min/max + cumulative sums drive
the full-range zone and close-through/partial-fill boundary.

F. FVG vectorization

Fair-value-gap (3-candle wick geometry, bull Low(C3) > High(C1); zone
[High(C1), Low(C3)]; strict zero-gap; newest closed bar eligible as C3 (no
1-bar lag); wick full-fill mitigation) is reproduced:
  reference == current : 197,032 / 197,032 bars
  dir / formation / bounds : 0 mismatches (180,251 active bars)

Loops over gap offsets with incremental min-L/max-H sliding windows; zone
type identifier assembled in the chained namespace (parity-absence guards
kept green).

G. Reference-vs-vectorized evidence

Full-scope audit over the homogeneous 197,032 feed bars (in-scope identical):

  CHoCH : 0 mismatches (dir / trend / events / bounds)
  OB    : 0 mismatches (dir / formation / mit / bounds)
  FVG   : 0 mismatches (dir / formation / bounds)

No tolerance hides the threshold semantics; the OB average-body boundary-flip
was found and removed (bit-exact newest-first sum matching the runtime).

H. Full runtime <-> research parity

Full authorized scope (194,985 bars; chain consumed on the 197,032 feed):

  runtime_created (canonical_oracle)   : 694
  research_created (F3SetupEngine)     : 694
  identity matches                     : 694 / 694
  runtime-only                         : 0
  research-only                        : 0
  per-bar state mismatch (in scope)    : 0

Result: 694 runtime == 694 research, identity 694/694, zero runtime-only /
research-only, zero per-bar mismatch. Full Candidate Setup parity.

I. Candidate Setup population

Authorized P3-S.17 in-scope population : 686 Candidate Setups

PRESERVED DISTINCTION (never collapse):
  full runtime/research computable population : 694
  P3-S.17 authorized in-scope population       : 686

De-overlap :
  leads              : 594
  follow-ons         : 92
  duplicate IDs      : 0

Historical correction (recorded, not silent): the P3-S.17R.1 "8 setups on 11
windows" came from pre-vectorization research ports whose CHoCH trend was
inverting, OB mitigation scanned older bars, and FVG window was detached from
the decision bar. Corrected kernels are validated against the frozen runtime
transcription and yield the population above.

J. P3-S.17 re-audit

Rerun on the corrected population:
  raw Candidate Setups (in scope) : 686      leads (de-overlapped) : 594
  follow-ons                     : 92       de-overlap separation : OK
  duplicate setup_ids rejected   : 0
  class distribution (leads)     : WIN 167 | LOSS 404 | UNRESOLVED 18 |
                                   AMBIGUOUS 5
  censoring                     : 22 UNRESOLVED (18 leads), never forced to
                                   LOSS
  ambiguity                      : 5 AMBIGUOUS (same-bar TP+SL)
  lifetime (sweep)               : sweep_age mean 21.0, choch_age mean 4.8
  leakage                        : NONE
  reproducibility                : PASS (deterministic re-run)

K. Label distribution (CONTRACT OBSERVATION only)

Leads, on open defaults (k_tp=1.5, k_sl=0.75, H=16):

  WIN          : 167  (28.1%)
  LOSS         : 404  (68.0%)
  UNRESOLVED   : 18   (3.0%)
  AMBIGUOUS    : 5    (0.8%)

This LOSS-heavy distribution is a DATASET CONTRACT observation about the
open-parameter candidate set. It MUST NOT be read as strategy / profitability
/ model failure, and no parameter was selected or optimized on it.

L. Open label parameters

Primary open label parameters :
    k_tp = 1.5
    k_sl = 0.75
    H    = 16

Robustness reference run(s) :
    H = 8
    symmetric 1.0 / 1.0

All label parameters remain OPEN, NOT OPTIMIZED, NOT AUC-SELECTED, NOT
PF-SELECTED. Any future review must be an authorized contract decision, never
a performance selection.

M. Production protection

NO MQL5 CHANGES. Unchanged : MQL5/** production files,
AF_Engine2_Setup.mqh, F1/F2/F3/F4 runtime semantics,
FEATURE_CONTRACT.md, SniperGold_ML.mqh, model weights, training pipeline,
legacy v4.x semantics. Research-side vectorization only.

N. Tickstory / Dukascopy status

DEFERRED. The current population was validated on the same source used for
runtime parity. Tickstory/Dukascopy remains a future independent
data-source robustness study and is NOT introduced automatically in the next
session.

O. Final verdict

FULL PARITY ACHIEVED.

  CHoCH : FULL PARITY        (reference == vectorized, 197,032/197,032)
  OB    : FULL PARITY        (reference == current, 197,032/197,032)
  FVG   : FULL PARITY        (reference == current, 197,032/197,032)
  Candidate Setup : 694 runtime == 694 research (identity 694/694,
                       runtime-only 0, research-only 0, mismatch 0)
  P3-S.17        : RE-AUDITED (686 in scope; 594 leads / 92 follow-ons)
  Production     : UNCHANGED
  ML             : NOT TOUCHED
  P3-S.18        : NOT STARTED

P. Next-session authorization boundary

The next session is a NEW DECISION GATE. It must explicitly choose:

  OPTION A — LABEL CONTRACT REVIEW
      review k_tp / k_sl / H, the LOSS-heavy (68%) observation,
      TP-before-SL suitability, and setup-outcome interpretation.
      Rules: no AUC, no PF, no ML training, no parameter optimization
      disguised as validation.

  OPTION B — P3-S.18 SETUP-LEVEL BASELINE ML
      permitted ONLY if the owner explicitly authorizes it.
      Would use ONE Candidate Setup as one observation, the P3-S.16 label
      contract, keep legacy MLP frozen as reference, create a separate
      setup-level baseline, and NOT compare it directly as if it predicted
      the legacy target.

  OPTION C — DESIGN DECISION REQUIRED

P3-S.18 is NOT started automatically. Parity does NOT auto-select B.
Until explicit authorization: no ML training, no LSTM/Informer/regime/
calibration, no AUC/PF optimization, no TP/SL or horizon change because of
LOSS rate, no Candidate Setup redesign, no MQL5 runtime changes, no
Tickstory/Dukascopy substitution.

Regression (final)

P3-S.2 17/17 | P3-S.3 20/20 | P3-S.4 20/20 | P3-S.5 20/20 | P3-S.6 20/20 |
P3-S.7 22/22 | P3-S.8 25/25 | F1 8/8 | F2 20/20 | F3 25/25 | F4 16/16 |
P3-S.16 20/20 | P3-S.17R  17/17 | SR 15/15 | VEC 15/15

No historical suite was modified or weakened.

Provenance / Close Verification

Forge HEAD (start) : 5cd1e7e...        (P3-S.17R.1 close)
Forge HEAD (close) : ff3202c8be59d9f1073b2f286e219c54f96eb44a
                     (recorded at final pre-close HEAD 7cc8af6...)
Branch / remote    : main == origin/main (forge.mql5.io/chiki2bum2/SniperGold_ML.git)
Working tree       : CLEAN
Close commit       : P3_S17R2_CLOSE_SHA (filled after this closed-session commit)

End P3-S.17R.2 official close handover. Verdict: FULL PARITY ACHIEVED. CHoCH / OB / FVG vectorized == frozen reference over the complete authorized scope; full runtime <-> research parity (694 == 694, 0 runtime-only, 0 research-only, 0 mismatch) with authorized in-scope population 686 (594 leads, 92 follow-ons); P3-S.17 re-audit completed; P3-S.18 blocked until separately authorized.