SniperGold_ML/docs/SESSION_HANDOVER_2026-08-22_P3_S6_DISPLACEMENT.md

5.4 KiB

SESSION HANDOVER — SNIPERGOLD_ML P3-S.6: DISPLACEMENT SPEC + CONFORMANCE

Date       : 2026-08-22 (session close)
Status     : P3-S.6 COMPLETE — spec + conformance done; synthetic tests 20/20;
             NOT yet committed (handover prepared before commit+push)
Forge      : https://forge.mql5.io/chiki2bum2/SniperGold_ML
Checkpoint : P3-S.5 07883f6abf116b656e2cb8adfb41ec47e1fce498 (VERIFIED clean at start)

1. SESSION OBJECTIVE

Formal Specification + Code-Conformance Audit for Displacement.

Question answered:
  Does the SniperGold code claiming to detect Displacement really implement the
  project-defined Displacement definition, and is it consistent with how OB/FVG/
  CHoCH use "strong movement"?

Questions NOT answered: profitability / AUC / PF (semantic audit only).
Human verification = CANCELLED. No production code changes. No ML / repair.

2. SOURCE RECONCILIATION (11 sources)

 1 AF_DetectDisplacement    AF_Engine2_Agents.mqh:281-291 (the ONLY displacement code)
 2 AF_AvgBody               AF_Engine2_Agents.mqh:120-127 (baseline)
 3 E agent consumer         AF_Engine2_Agents.mqh:606,627-640,659-660
 4 OB "strong move"         AF_Engine2_Agents.mqh:304-305; AF_Defines.mqh:60 (1.5 x avg)
 5 DESIGN.md                docs/DESIGN.md:132-133 ("strong move" / "displacement")
 6-8 FEATURE_CONTRACT / EA / Python : 0 displacement refs
 9 Legacy v4.3/v4.4/v4.5    : NO displacement concept (0 refs)
10 P3-S.4/S.5/S.3 specs     : displacement declared NOT REQUIRED for FVG/OB/CHoCH
11 External (XAUUSD_MTF_Liquidity_OB_Reversal) : not wired

Core finding — Displacement vs OB "strong move" (brief §9):

Displacement  : body >= 1.6 x avg body (AF_DetectDisplacement), newest closed bar,
                no structure, per-bar attribute.
OB strong move: body >= 1.5 x avg body (AF_E3_MOVE_BODY), the OB move candle.
-> SAME CONCEPT FAMILY, different constants. Answer: B (simplified proxy for
   displacement, lower threshold). Since 1.6 > 1.5, every displacement candle is
   an OB strong-move candle, but body in [1.5, 1.6) x avg is strong for OB and
   NOT displacement -> BUG-P3S6-001 (cross-concept inconsistency).

3. SPECIFICATION (docs/SMC_DISPLACEMENT_SPEC_v1.md)

DEFINITION : body >= 1.6 x avg body on the NEWEST CLOSED bar; direction by
             Close vs Open (+1/-1/0); PURE CANDLE ATTRIBUTE.
MEASUREMENT: |Close-Open| vs avg body (AF_AvgBody, 20 bars, candidate INCLUDED);
             range/wicks/ATR/body-to-range NOT used.
THRESHOLD  : >= 1.6 x avg (inclusive); boundary tested (T05/T06/T07).
STRUCTURE  : NONE required (no BOS/CHoCH/sweep/FVG/OB).
FVG rel.   : NOT REQUIRED (independent; correlated in practice).
OB rel.    : strong move = same family, lower constant (BUG-P3S6-001).
CHoCH rel. : NOT REQUIRED (independent).
LIFECYCLE  : CANDLE ATTRIBUTE per bar; no persistence, no events, no stale state.
TIMEFRAME  : per-TF independent; canonical = AMBIGUOUS (A-1).
PARITY     : PARITY = N/A BY ABSENCE (not in contract/EA/Python/v4.x).

4. CONFORMANCE (docs/P3_S6_DISPLACEMENT_CONFORMANCE.md)

Definition/Measurement/Baseline/Threshold/Timing/Closed-bar (E-1..E-5,E-10,E-11): CONFORMING
Lifecycle (E-12)              : CONFORMING (no stale state; DP-T18)
Structure/FVG/CHoCH (E-6,E-7,E-9): CONFORMING (independent; no requirement)
OB relationship (E-8)         : PARTIALLY CONFORMING (BUG-P3S6-001)
Consumer behavior (E-14)      : CONFORMING (per-bar; no stale consumer)
Timeframe (E-13)              : SPECIFICATION AMBIGUOUS (A-1)
Runtime/training parity (E-15): CONFORMING (N/A by absence)

VERDICT : CONFORMING
  The displacement primitive matches the project specification exactly. The only
  findings: cross-concept threshold inconsistency (OB 1.5 vs disp 1.6) and the
  usual canonical-timeframe ambiguity. The f7/CHoCH/FVG/OB stale-consumer bug
  class does NOT apply (displacement has no state).

5. SYNTHETIC TESTS — 20/20 PASS

spec_tests_displacement.py + spec_test_cases_displacement.json
+ output/spec_tests_displacement_report.json
DP-T01..T20 all pass; symmetry asserted on every case; code_port == spec in ALL
cases (implementation conforms). Boundary: body 0.1652174 vs thr 0.165217392
(inclusive >=). Parity scan clean.

6. CONFIRMED BUGS (document-only)

BUG-P3S6-001 [LOW] cross-concept inconsistency: OB "strong move" 1.5 x avg body
(AF_E3_MOVE_BODY) vs Displacement 1.6 x avg body (AF_DetectDisplacement) — same
concept family, two undocumented constants. Fix deferred to consolidated repairs.
No consumer/stale-state bug exists for displacement (proven DP-T18).

7. AMBIGUITIES

A-1 canonical displacement timeframe (MTF vs M15) — same class as CHoCH G-4 /
    sweep G-3 / FVG A-3 / OB A-4.
A-2 "strong move" vs "displacement" terminology (BUG-P3S6-001).

8. NO PRODUCTION CHANGE — only P3-S.6 artifacts added; 0 files modified.

9. NEXT GATE: P3-S.7 MTF Alignment -> P3-S.8 Candidate Setup.

10. ARTIFACTS

docs/SMC_DISPLACEMENT_SPEC_v1.md
docs/P3_S6_DISPLACEMENT_CONFORMANCE.md
ml/p3/smc_semantic/spec_tests_displacement.py
ml/p3/smc_semantic/spec_test_cases_displacement.json
ml/p3/smc_semantic/output/spec_tests_displacement_report.json
docs/SESSION_HANDOVER_2026-08-22_P3_S6_DISPLACEMENT.md  (this document)

11. COMMIT & PUSH STATUS

NOT YET COMMITTED at handover write time.
Planned message:
  research: P3-S.6 Displacement formal spec + conformance audit (CONFORMING)