SniperGold_ML/docs/P2_2_EQH_EQL_FORENSIC.md

2.9 KiB

P2.2 — EQH/EQL SEMANTIC ADJUDICATION

Status: SEMANTICS RESOLVED — parity 0/0 mismatch (14850 rows)
Date: 2026-08-21
Decision: legacy runtime/v4.4 semantics = production source of truth (provisional)


1. Semantic differences (Python training vs EA/v4.4)

Aspect Python training (build_features) EA/v4.4 (DetectEQ)
Pair selection consecutive same-type pivots (skipping opposite types) CONSECUTIVE pivots in the g_sp list (must be same type)
ATR basis EQ_TOL_ATR * A[p] (ATR at the pivot bar) EQ_TOL_ATR * g_atr (CURRENT ATR, row bar)
Pair window full history 700-bar cache, pivots valid [r-649, r-50]
Sweep bar > p2 with high/low breaking the 2nd pivot price same (bars p2+1..total)

v4.4 DetectEQ (Indicators\Downloads\SniperGold_SMC_ProPlus_v4_4.mq5:671) is IDENTICAL to the EA DetectEQ (AlgoForge_Backtest_Baseline.mq5:310) — the EA copies v4.4 faithfully.


2. Reconstruction & quantitative evidence

ml/parity/recon_eq.py — DetectEQ reconstruction in Python over the full-history pivot list + EA window filter:

PY-training              f10 = 0.9846   f11 = 1.0000   (reproduces parity report SB-06)
RECON-A (EA pairs, ATR@pivot)   = 0.9846 / 1.0000      (pair selection NOT dominant)
RECON-B (EA pairs, ATR@row)     = 0.0523 / 0.0000      (ATR basis = dominant factor)
RECON-C (window + ATR@row)      = 0.0000 / 0.0000      (window closes the f10 remainder)

Dominant factor = ATR basis (row ATR vs pivot ATR). Secondary factor = pair list window (700-bar cache, absolute pivots [r-649, r-50] because begin=max(100, total-600), len=50, p_rel in [50,649]).

Note: RECON-A == PY-training (0.9846/1.0000) shows the pair-selection difference does NOT change the output flag on this data — the real driver is ATR.


3. Decision

Chosen semantics : legacy runtime/v4.4
  - consecutive pivots in the list (g_sp[i-1], g_sp[i]), both same type
  - bar distance >= EQ_BARS (3)
  - tol = EQ_TOL_ATR (0.10) x CURRENT row-bar ATR
  - sweep: exists bar (p2, r] with high > p2.price (EQH) / low < p2.price (EQL)
  - pair list bounded by the EA analysis window (700-bar cache, pivots [r-649, r-50])

Reason : runtime reproduction 0/0 mismatch on 14850 rows; P2 policy:
         legacy runtime/v4.4 = provisional production source of truth.
         No EQH/EQL redesign in this session (recorded as a future research
         experiment: non-monotonic flag because row ATR fluctuates).

Legacy status : v4.4 semantics (EA copies v4.4 faithfully) = TRUSTED
Parity         : f10 0/14850, f11 0/14850 (Python reconstruction)

4. Training implications

build_features must be changed (in the P2.5 implementation):

  • consecutive-list pairs, not same-type-skip;
  • tol = EQ_TOL_ATR * A[i] (current bar ATR), not A[p];
  • pivot list bounded by the same window as runtime (700-bar cache semantics).