# SESSION HANDOVER — SNIPERGOLD_ML P3-S.3: CHOCH / MSS SPEC + CONFORMANCE ```text Date : 2026-08-22 (session close) Status : P3-S.3 COMPLETE — spec + conformance audit done; commit+push verified Forge : https://forge.mql5.io/chiki2bum2/SniperGold_ML Checkpoint : P3-S.2 595b4c9a622703b05228bd563b4979fef81a2ebf (verified clean at start) ``` --- ## 1. SESSION OBJECTIVE ```text Formal Specification + Code-Conformance Audit for CHoCH / MSS. Question answered: Does the SniperGold code claiming to detect CHoCH/MSS really implement the CHoCH/MSS definition established by the PROJECT SEMANTIC SPECIFICATION? Questions NOT answered: - Does CHoCH generate profit? - Is the universal SMC definition correct for every trader? ``` Principle: SPEC FIRST, CODE AUDIT SECOND. Human verification = CANCELLED. No production code changes (Phase D). --- ## 2. SOURCE MATERIAL (15 sources, reconciled) ```text 1 FEATURE_CONTRACT v1.0 (f8/f9/f18) docs/FEATURE_CONTRACT.md 2 DESIGN.md (Algo Forge) docs/DESIGN.md ("CHoCH/MSS" label, N agent) 3 DESAIN_MTF_v45.md Shared Projects\SniperGold_ML 4 v4.3/v4.4/v4.5 ProcessStructure Indicators\Downloads\SniperGold_SMC_ProPlus_v4_3/4_4/4_5.mq5 5 EA ProcessStructure (current) Experts\AlgoForge_Backtest_Baseline.mq5:294-340 6 build_features_p2.py ml/parity/build_features_p2.py (equal-allowed pivots) 7 train_model.py build_structure ml/train_model.py:161-229 (STRICT pivots) 8 smc_semantic_common.py ml/p3/smc_semantic/ (forensic infra) 9 AF_DetectChoch / AF_DetectBos Include\AlgoForge\AF_Engine2_Agents.mqh:238-256 10 AF_BuildStructLines Include\AlgoForge\AF_Engine2_Display.mqh:137-192 11 P3-S.0 f7 forensic docs/P3_S_F7_EVENT_LIFECYCLE_FORENSIC.md 12 P3-S.2 spec+conformance docs/SMC_LIQUIDITY_SWEEP_SPEC_v1.md + conformance 13 Golden dataset doc docs/P3_SMC_SEMANTIC_GOLDEN_DATASET.md 14 audit_choch_state.json (NEW) ml/p3/smc_semantic/output/ (CHoCH state forensic) 15 parity_choch_pivot_*.json (NEW) ml/p3/smc_semantic/output/ (strict vs equal pivots) Three semantic layers separated: INTENDED : CHoCH = reversal of the internal structure (close break of the last internal swing + opposite prior trend + non-opposing swing gate); CHoCH/MSS = synonymous labels; Sweep->CHoCH->OB/FVG chain (40); a separate MSS (break+displacement) is NOT defined. LEGACY : trigger identical; the signal gate applies freshness (curBar-chochBar)<=40; ML features f8/f9/f18 use a PERSISTENT state without expiry. CURRENT : trigger identical; f8 = last CHoCH (persistent per contract); f9/f18 = raw-state consumption WITHOUT expiry (stale 34.7% / 58%); Engine 2 AF_DetectChoch = second definition (fractal 2/2, no gate, per-TF); display = third definition (fractal 2/2). ``` --- ## 3. SPECIFICATION (docs/SMC_CHOCH_MSS_SPEC_v1.md) ```text REFERENCE : f8/f9 = last internal swing pivot, fractal 5/5 (equal allowed), single level; swing len=50 is only the gate; HTF NOT valid. FORMATION : fractal 5/5, equal allowed, confirmation p+5 <= b, window [max(95,t-604), t-5]; MIN_BARS gate 160. CHOCH : bullish: close[b] > last internal pivot high, prior trend<0, SwingTrendAt(b)>=0. bearish: symmetric (close < last low, prior>0, SwingTrendAt<=0). CLOSE-CONFIRMED; wick-only insufficient; body not required; displacement NOT required. MSS : SAME AS CHOCH (project synonym label). No separate MSS primitive (code grep = 0 matches). MSS+displacement NOT adopted. DIRECTION : +1 bullish (reversal from down), -1 bearish, 0 none. PRECONDITION: prior internal trend != 0 (the first break = BOS, not CHoCH); non-opposing swing gate (>=0/<=0 — WEAK gate, A-4). TEMPORAL : closed bar t; break b <= t; pivot p+5 <= b; no future. EVENT/STATE : EVENT (detection) + STATE (f8 last dir, persistent per contract) + VALIDITY WINDOW 40 for chain consumers (f9/f18/signal gate). LIFECYCLE : NO_CHOCH / ONSET / ACTIVE / EXPIRED / SUPERSEDED; INVALIDATED & CONSUMED not modeled. TIMEFRAME : f8/f9 = M15 ONLY; Engine 2 per-TF (H4/M30/M15/M3); canonical project = SPECIFICATION AMBIGUOUS (MTF). SWEEP REL : CHoCH detection STANDS ALONE; the f9 chain = ordering+direction+ freshness; f7 NOT changed. ``` --- ## 4. CONFORMANCE (docs/P3_S3_CHOCH_MSS_CONFORMANCE.md) ```text Detection chain (E-1..E-10, E-12) : CONFORMING structure, swing, trigger, break semantics, direction, precondition, closed-bar, detector lifecycle (one event per transition), f8 state. Confluence gate (E-7) : PARTIALLY CONFORMING WEAK gate (>=0/<=0) vs the "align" comment (A-4); the spec adopts weak. Event-consumer lifecycle (E-11) : NON-CONFORMING (BUG-P3S3-001) f9/f18 without SEQ_WINDOW -> stale confirm (34.7% f9 / 58% f18 leg). Runtime-training pivots (E-13) : PARTIALLY CONFORMING parity feed OK (P2.5 1e-9); train_model/P3-infra STRICT diverge (0.26% choch_dir / 2.40% choch_bar). MSS distinct (E-14) : CONFORMING (no MSS claim) Engine 2 / Display (E-15) : CONFORMING to its own definition; project AMBIGUOUS Same-bar precedence (E-16) : SPECIFICATION AMBIGUOUS (unreachable) VERDICT : PARTIALLY CONFORMING (conformance to the project spec; NOT profitability/edge) ``` --- ## 5. SYNTHETIC TESTS ```text Runner : ml/p3/smc_semantic/spec_tests_choch_mss.py Cases : ml/p3/smc_semantic/spec_test_cases_choch_mss.json (20 cases) Report : ml/p3/smc_semantic/output/spec_tests_choch_mss_report.json Result : 20/20 PASS CH-T01..T15 (required) + T16 (MSS distinction) + T17 (confirmation boundary) + T18 (gate suppression) + T19 (gate permissive) + T20 (BOS continuation). spec_oracle (truth, from SPEC S-3..S-10) == expected in all cases. code_port (EA port, observation) MATCHES spec in all DETECTION (f8/events); DIVERGES in the chain consumer: CH-T08 spec f9=0 (expired age>40) vs code f9=1 (stale) -> synthetic evidence for BUG-P3S3-001. Expected derived from SPEC, NOT from production code. NO AUC/PF/backtest/human annotation/ML on the test path. ``` --- ## 6. STATE/EVENT FORENSIC (diagnostic, mirrors f7 P3-S.0) ```text Output : ml/p3/smc_semantic/output/audit_choch_state.json Population XAUUSD M15 2017-2026 (n=197.032, runtime-semantics equal-allowed): CHoCH onsets : 2.197 active bars (f8 != 0) : 196.817 (99.89%) | repetition 89.6x (f7 = 69.5x) state run median/max : 318 / 2.187 bars state age median/p99 : 49 / 242 bars (max 418) state returns to 0 : NEVER after the first event (same as f7) f9 chochOK TRUE : 51.105 bars -> STALE (age>40) 17.714 (34.7%) f18 +15 leg : 97.826 bars -> STALE 56.761 (58.0%) Finding: the f7 pattern repeats on the CHoCH side — the DETECTOR is correct (one event per transition), but the CONSUMERS (f9/f18) count the stale state as repeated confirmation. Old unit tests do not prove this (not this test path). ``` --- ## 7. RUNTIME/TRAINING PARITY (diagnostic, no retraining) ```text Output : ml/p3/smc_semantic/output/parity_choch_pivot_strict_vs_equal.json strict (train_model.build_structure) vs equal-allowed (build_features_p2.build_structure_fast == EA): choch_dir mismatch : 512 bars (0.26%) choch_bar mismatch : 4.722 bars (2.40%) onsets : 2.165 (strict) vs 2.197 (equal) The parity feed build_features_p2 (deployed-model P2.6 path) == runtime (P2.5 1e-9 for f8/f9). The divergence exists only in the old train_model path + P3 forensic infra (BUG-P3S3-002, documented). ``` --- ## 8. CONFIRMED BUGS (document-only; NOT fixed in P3-S.3) ```text BUG-P3S3-001 [MEDIUM] CONFIRMED, NOT FIXED f9 (chochOK) & f18 (+15 leg) consume CHoCH state WITHOUT SEQ_WINDOW -> a stale event stays "confirmed" (34.7% f9 / 58% f18 leg; state age p99 242 bars). Same bug class as BUG-P3S2-001 (sweep side); P3-S.0 only fixed f7. Fix: (t - chochBar) <= 40 at f9/f18 OR refactor to a single event lifecycle. BUG-P3S3-002 [LOW] DOCUMENTED train_model.build_structure (STRICT pivots) vs EA/parity feed (equal allowed): diverge 0.26% choch_dir / 2.40% choch_bar. Fix: use _pivots_vec on all training/forensic paths. BUG-P3S3-003 [INFO] DOCUMENTED InpConfluenceFilter comment "align with swing trend" vs the WEAK gate (>=0/<=0). Spec A-4 = small AMBIGUITY; adjudicate weak vs strong gate. ``` --- ## 9. SEMANTIC AMBIGUITIES ```text 1. MSS vs CHoCH (terminology) : project synonym labels; a separate MSS (break+ displacement) NOT defined -> AMBIGUOUS (no code). 2. Two/three CHoCH definitions : f8/f9 (5/5+gate, M15) vs Engine 2 (2/2, no gate, per-TF) vs Display (2/2, chart TF). f8/f9 is authoritative for ML. 3. Weak confluence gate : >=0/<=0 ("non-opposing") vs "aligned". 4. Canonical timeframe : f8/f9 M15 explicit; the HTF role vs LTF events not established (same as sweep G-3). 5. Event vs state in consumers : f8 state (per contract); f9/f18 should be event+window (BUG-P3S3-001). ``` --- ## 10. NO PRODUCTION CHANGE ```text No production code was modified. AF_Engine2_Agents.mqh / AF_DetectChoch / AF_DetectBos / ProcessStructure / f8 / f9 / f18 / f7 / f10 / f11 / OB / FVG / Displacement / ML / Engines 2-3 : NOT touched. Only P3-S.3 research artifacts added (spec, conformance, tests, forensic, parity, handover). P3-S.2 artifacts (immutable) UNCHANGED (git status: only new files, 0 modified). ``` --- ## 11. HUMAN VERIFICATION STATUS ```text HUMAN VERIFICATION = CANCELLED Human annotation not required for P3-S.3. Human A/B comparison NOT part of the validation path. No new human annotation requests. The human_package/ remains as a historical artifact. ``` --- ## 12. NEXT GATE ```text After the CHoCH/MSS verdict (PARTIALLY CONFORMING): FVG -> OB -> Displacement -> MTF Alignment -> Candidate Setup. DO NOT return to ML; DO NOT build a meta-label; DO NOT create new event labels. ``` --- ## 13. CHECKPOINT & PROVENANCE (P3-S.3) ```text Forge HEAD (before the P3-S.3 commit) : 595b4c9a (P3-S.2) — VERIFIED P3-S.0 commit : b519a34 P3-S.1 commit : 8c1ef6c P3-S.2 checkpoint : c7a2b3f5e6acbf8deb748315dcbcc200046d0b84 FEATURE_CONTRACT : C44CC6F2... (P2-era) / 7b908b12... (committed) symbol/tf : XAUUSD / M15 (2017-01-01 .. 2026-08-20) Human verification : CANCELLED ``` --- ## 14. P3-S.3 ARTIFACTS ```text docs/SMC_CHOCH_MSS_SPEC_v1.md docs/P3_S3_CHOCH_MSS_CONFORMANCE.md ml/p3/smc_semantic/spec_tests_choch_mss.py ml/p3/smc_semantic/spec_test_cases_choch_mss.json ml/p3/smc_semantic/output/spec_tests_choch_mss_report.json ml/p3/smc_semantic/output/audit_choch_state.json ml/p3/smc_semantic/output/parity_choch_pivot_strict_vs_equal.json ml/p3/smc_semantic/audit_choch_state.py ml/p3/smc_semantic/parity_choch_pivot_check.py docs/SESSION_HANDOVER_2026-08-22_P3_S3_CHOCH_MSS.md (this document) ```