# SNIPERGOLD_ML SESSION HANDOVER ## Session Metadata ```text Date: 2026-08-21 Timezone: UTC+7 (MetaTrader server offset +7, local Asia UTC+7) Session purpose: P1 correctness repair (SB-01, SB-02, SB-06) + formal session close & handover Starting Forge HEAD: bb5eec05efc4b8493154e25c02b6f019ec50365f Ending Forge HEAD: (recorded in section 11 after push) Repository: https://forge.mql5.io/chiki2bum2/SniperGold_ML.git Local workspace: D:\TradingTerminal\HFM Metatrader 5\MQL5 Publish mirror: D:\TradingTerminal\HFM Metatrader 5\MQL5\Shared Projects\AlgoForge\publish\AlgoForge ``` Repository layout note (identified, NOT merged): ```text authoritative local source : D:\TradingTerminal\HFM Metatrader 5\MQL5\Shared Projects\SniperGold_ML (train_model.py, repaired\*) research artifacts : D:\TradingTerminal\HFM Metatrader 5\MQL5\Shared Projects\AlgoForge\ml\parity\* ; MQL5\Files\* ; MQL5\Profiles\Tester\* legacy project : D:\TradingTerminal\HFM Metatrader 5\MQL5 (git root HEAD 609bcfd, README only; audit-only, never published) publish mirror : D:\TradingTerminal\HFM Metatrader 5\MQL5\Shared Projects\AlgoForge\publish\AlgoForge (authoritative Forge source) ``` --- ## 1. Session Objective This session performed the **P1 correctness repair** on SniperGold_ML: ```text SB-01 validation AUC bug in train_model.py -> FIXED + TESTED SB-02 temporal label overlap (purge gap = H_LABEL) -> FIXED + VERIFIED SB-06 runtime-vs-training feature parity harness -> MEASURED + VERIFIED ``` All three are complete, each with a mandatory regression test and full provenance (git SHA / dataset hash / config hash / seed / Python version recorded in the evidence logs and P1_REPAIR_REPORT.md). The session was **stopped before P2** by explicit instruction. No LSTM v2 / Informer / MS-GARCH / meta-label gate / threshold or hyperparameter optimization was started. The freeze model was not modified. --- ## 2. Verified Repository State ```text Forge HEAD (before close): bb5eec05efc4b8493154e25c02b6f019ec50365f (branch main) Forge HEAD (after close): see section 11 (verified via git ls-remote after push) Local state: D:\TradingTerminal\HFM Metatrader 5\MQL5 git root main @ 609bcfd077d13a82260367f35613d9ef42c69b29 ('Initial commit', 2026-01-16); only README.md tracked; entire project untracked by design (audit-only repo). Publish mirror state: D:\TradingTerminal\HFM Metatrader 5\MQL5\Shared Projects\AlgoForge\publish\AlgoForge branch main @ bb5eec05efc4b8493154e25c02b6f019ec50365f working tree CLEAN before close (verified: git status) Sync status: publish mirror HEAD == Forge HEAD (verified via git ls-remote origin HEAD) Uncommitted state: publish mirror: clean before close commit. Local root: untracked research artifacts (expected; never published). ``` Verification commands executed during close: ```text git rev-parse --abbrev-ref HEAD -> main git rev-parse HEAD -> bb5eec05efc4b8493154e25c02b6f019ec50365f git status --porcelain -> (empty) git ls-remote origin HEAD -> bb5eec05efc4b8493154e25c02b6f019ec50365f ``` --- ## 3. P1 Results ### SB-01 — Validation AUC bug Old (bug): ```text auc(yv.ravel(), Pv[:,0]) validation ≈ 0.5005 best_epoch = 0 ``` The old metric flattened the two-head labels and compared them against only one head's predictions -> validation AUC ~ 0.5005 (≈ random). Early stopping therefore selected epoch 0; the freeze model (TEST 0.6270/0.6207) is a ~1-epoch model — an artifact of the broken metric, not of the methodology. New (fixed): ```text per-head validation AUC (val_auc_2head: AUC(y_long,P_long) and AUC(y_short,P_short), mean for early stopping) VAL LONG = 0.6796 VAL SHORT = 0.6796 TEST LONG = 0.6582 TEST SHORT = 0.6582 best_epoch = 55 ``` Regression Test A: **PASS** (synthetic 2-head labels: per-head AUC = 1.0; legacy `ravel` metric = 0.6250 != 1.0 -> proves two-head labels ≠ flattened labels against one head). Baseline lama `0.627/0.6207` is now classified **SUPERSEDED**. ### SB-02 — Temporal label overlap ```text OLD: train = 35652 test = 11885 overlap exists: max_train_outcome_end = 44995 >= min_test_outcome_start = 44973 NEW: train = 35652 purge = 13 (gap = H_LABEL = 24 bars, purge bars removed) test = 11872 split_bar = 44972 ``` Inequality verification (explicit check, enforced by `purge_verify` which raises RuntimeError on overlap): ```text 44995 < 44997 -> OK, no train/test outcome overlap ``` Regression Test B: **PASS** (synthetic split fails on the OLD scheme, passes on the NEW purged scheme). ### SB-06 — Runtime-vs-training feature parity ```text timestamp join = 14850 / 14850 feed identical = close max|d| = 0.0000 ``` Per-feature groups (mismatch rate on joined samples): ```text Formula-clean (rate = 0.0000): f4_internal f5_bias f7_sweep f12_dsign f16_mom20 Edge-small (rate < 0.004): f13_dmag 0.0007 | f3_swing 0.0017 | f8_choch 0.0035 | f9_chochok 0.0025 Window-sensitive(A-window: EA 600-bar runtime window vs training full history): f6_eqpos 0.5492 | f14_dhigh 0.3104 | f15_dlow 0.2974 | f17_range 0.5492 Formula-mismatch(B-formula): f10_eqh 0.9846 | f11_eql 1.0000 Unresolved HTF (B-formula): f0_htf1 0.3609 | f1_htf2 0.4516 | f2_htf3 0.5130 Derived (follows above): f18_conf 0.5189 ``` Key findings: ```text 1. A-window mismatch is MATERIAL, not cosmetic: range_atr : EA 56.99 vs py_full 10.44 (2026-06-16 13:30) eqpos : EA -21.14 vs py_full -0.86 The README claim that the window difference "practically does not change results" is DISPROVED by the parity evidence. This is the plausible explanation for the runtime cross-feed AUC drop 0.627 -> 0.5305. 2. "mom fix" = INVALID. An attempted EA edit (close[tc-21] -> close[tc-20]) was reverted: the parity harness proved the ORIGINAL formula was correct (the tc parameter receives tcv = total, so close[tc-21] = 20 intervals). After revert, f16_mom20 mismatch rate returned to 0.0000. Lesson: the parity harness caught my own wrong "fix". 3. Top-40 mismatch classification: 32 x A-window, 8 x B-formula. ``` --- ## 4. Current Evidence Classification ```text 0.627/0.621 freeze = SUPERSEDED (broken SB-01 metric + SB-02 overlap) 0.6582/0.6582 post-purge = TRUSTED as corrected offline estimate runtime cross-feed 0.5305/0.5487 = INCONCLUSIVE (contaminated by now-measured parity gap) PF 1.32 (308 trades) = INCONCLUSIVE parity report = TRUSTED historical pre-purge evidence = PRESERVED (pre_purge_run.log + renamed INVALID artifact) ``` Explicit: ```text 0.6582/0.6582 is NOT a deployment claim. Runtime/training parity is not yet fully resolved. ``` --- ## 5. Current Architecture State ```text Engine 1 = MTF data/cache (implemented, verified) Engine 2 = N/C/E/P SMC + fuzzy (4 independent signal agents + weighted aggregator, implemented) Engine 3 = renderer (display only, reads Engine 1-2 output, implemented) MLP = static, SEPARATE from Engine 2 (19->12->2, per-head Platt calibration, exported .mqh; NOT an Engine 2 component) LSTM = No-Go experiments (Phase 4 sub-session 3; gate per protocol G1-G7) Regime-aware ML = not implemented Meta-label gate = not implemented ``` The target architecture is NOT described as implemented anywhere in this document. --- ## 6. Open Blockers for P2 ### P2-A — HTF Bias ```text f0-f2 mismatch = 36-51% root cause = UNRESOLVED ``` A faithful Python replica of the EA BTTFBias logic on the same data does NOT reproduce the EA output (probe_htf.py / probe_ea_bttf.py / probe_htf2.py / probe_htf3.py; probe_htf4.py hit a degenerate case with no M15 bars at the gold daily break). The EA tester's D1 cache content differs from the training feed. BTTFBias input/cache state must be traced. Status: **BLOCKING — SOURCE OF TRUTH = UNRESOLVED** ### P2-B — EQH/EQL ```text f10_eqh mismatch = 98.5% f11_eql mismatch = 100% ``` Python training uses same-type pivot pairs + ATR at the pivot bar; EA/v4.4 uses consecutive-in-list pivot pairs + current ATR. Current policy: legacy runtime/v4.4 semantics = current production reference. But semantics are NOT to be considered theoretically correct yet. Status: **BLOCKING DESIGN DECISION** (do not silently align) ### P2-C — Runtime Context Window ```text Affected: f6_eqpos, f14_dhigh, f15_dlow, f17_range Finding: Python/full history vs EA/600-bar runtime window ``` Material magnitude proven (see SB-06); this is the largest economic impact item. Status: **BLOCKING** — the production runtime window must become an explicit contract. --- ## 7. Source-of-Truth Policy for Next Session ```text Production runtime semantics are the default source of truth for features actually consumed by the deployed MQL5 runtime. Exception: If runtime semantics are proven to be a semantic bug, do not silently copy them into training. Instead: LEGACY-BUG -> define corrected semantics -> update runtime -> update training -> establish parity ``` Per blocker: ```text HTF bias : UNRESOLVED EQH/EQL : legacy runtime/v4.4 semantics = provisional production source Context window : runtime deployment window = provisional production contract ``` --- ## 8. Experimental Freeze Until P2 is complete: ```text NO LSTM v2 NO INFORMER NO MS-GARCH NO REGIME GATE NO META-LABEL GATE NO HYPERPARAMETER OPTIMIZATION NO THRESHOLD OPTIMIZATION NO PF OPTIMIZATION NO NEW TRADING CLAIM ``` The MLP architecture (19->12->2) and seed 42 must be preserved for baseline comparison. --- ## 9. Next Session Entry Criteria The next session starts with **P2 SOURCE-OF-TRUTH ADJUDICATION**, in order: ```text P2.1 HTF bias forensic trace (debug dump EA BTTFBias input/cache; resolve f0-f2) P2.2 EQH/EQL semantic adjudication (decide pivot-pair + ATR convention; f10/f11) P2.3 runtime context window (decide window contract; f6/f14/f15/f17) P2.4 FEATURE_CONTRACT (write the explicit feature contract document) P2.5 full 19-feature parity (re-run harness until all features clean by contract) P2.6 corrected baseline (retrain/evaluate on parity-corrected feed) P2.7 runtime probability parity (CSV mode-0 AUC parity runtime vs training) ``` P2.1–P2.5 must NOT be skipped to jump directly to a new model. --- ## 10. Required Artifacts from This Session Committed to this repository (repo-relative paths, SHA256 verified at close): ```text docs/SESSION_HANDOVER_2026-08-21_P1.md repaired/P1_REPAIR_REPORT.md 85FCE2D34BD6BDD7A5B1A67A3708A48E0438BE7430D536A9F2E6086BD86E191A repaired/pre_purge/pre_purge_run.log repaired/pre_purge/SniperGold_ML_prepurge_INVALID_overwritten_by_postedit_run.mqh repaired/post_purge/post_purge_run.log repaired/post_purge/SniperGold_ML_postpurge.mqh 9D8906A89DB6580A01A1F1747E6E24D4C9D3F849910AEDCE2AFE873B6F1FE44E ml/parity/parity_harness.py 5C04ADD5CA1AB1DA306BF25BA7DBC4968D447F6DAD8730DDF8ABA75A1C90037F ml/parity/RUNTIME_TRAINING_PARITY_REPORT.md 300E5DCFF205BC35FFA369C4D888D0A9C935233117EA839EF13FEBEA1AC2382D ml/parity/AlgoForge_bt_features_XAUUSD_M15.csv DCA3AC50D7B6465365D6EBE6DF43F96CAC91809153630C1A88B188480C387D44 ml/train_model.py 1B967C764638A7B1FED66D3B7C80A88E2FF0AE8311E5C1D7F406870CBC8B02E5 MQL5/Experts/AlgoForge_Backtest_Baseline.mq5 A19891E40A5EA0D400F54E54ED42BDCD1D517C0EE1FE1FA9F121795B7B3E4FBA ``` Freeze model (NOT modified during P1, NOT committed, remains in local workspace): ```text D:\TradingTerminal\HFM Metatrader 5\MQL5\Include\SniperGold_ML.mqh SHA256 C0D5CAE6663F457D2C87750BC8690B47EF4557D0426BFB4183280DC1D1A2F1E5 header 'AUC validasi : 0.5005 | AUC long: 0.6270 | AUC short: 0.6207' = SB-01 bug evidence ``` Additional local research artifacts (NOT committed, remain in local workspace): ```text D:\TradingTerminal\HFM Metatrader 5\MQL5\Shared Projects\SniperGold_ML\repaired\diag_epoch0.py D:\TradingTerminal\HFM Metatrader 5\MQL5\Shared Projects\SniperGold_ML\repaired\probe_npz.py D:\TradingTerminal\HFM Metatrader 5\MQL5\Shared Projects\SniperGold_ML\repaired\probe_feed.py D:\TradingTerminal\HFM Metatrader 5\MQL5\Shared Projects\SniperGold_ML\repaired\probe_mom_eq.py D:\TradingTerminal\HFM Metatrader 5\MQL5\Shared Projects\SniperGold_ML\repaired\probe_htf.py / probe_htf2.py / probe_htf3.py / probe_htf4.py / probe_ea_bttf.py D:\TradingTerminal\HFM Metatrader 5\MQL5\Profiles\Tester\AlgoForge_Parity.XAUUSD.M15.20260101_20260820.000.ini (F17A1B00...) D:\TradingTerminal\HFM Metatrader 5\MQL5\Files\SniperGold_ML\features_XAUUSDc.npz (E60285F5... training cache, immutable) D:\TradingTerminal\HFM Metatrader 5\MQL5\Files\AlgoForge\Data\features_XAUUSD.npz (547072AB... new cache, NOT used in P1) ``` --- ## 11. Commit & Push ```text Branch: main (publish mirror) Commit message: chore: close 2026-08-21 P1 repair session with handover Reviewed diff: only closure/evidence artifacts listed in section 10 (plus updated EA) Final Forge HEAD: 3e38d0e0f45109be0184bf1ed0120b7d8a532558 (verified via git ls-remote origin HEAD; canonical close commit = d55a481, follow-up doc commit = 3e38d0e) ``` --- ## 12. Final Checkpoint ```text Final Forge HEAD: 3e38d0e0f45109be0184bf1ed0120b7d8a532558 (canonical close commit d55a481; follow-up doc commit 3e38d0e) Commit: d55a481 (close) + 3e38d0e (checkpoint finalization) Author: chiki2bum2 Timestamp: 2026-08-21T19:33:40+07:00 Repository clean: YES (git status: nothing to commit, working tree clean) Push verified: YES (git ls-remote origin HEAD == 3e38d0e == local HEAD at verification) ```