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

216 lines
9.6 KiB
Markdown
Raw Permalink Normal View History

# SESSION HANDOVER — SNIPERGOLD_ML P3-S.7: MTF ALIGNMENT SPEC + CONFORMANCE
```text
Date : 2026-08-22 (session close)
Status : P3-S.7 COMPLETE — spec + conformance done; synthetic tests 22/22;
NOT yet committed (handover prepared before commit+push)
Forge : https://forge.mql5.io/chiki2bum2/SniperGold_ML
Checkpoint : P3-S.6 533c8c6647a552d01a1a290cb2d0505f94887666 (VERIFIED clean at start)
```
---
## 1. SESSION OBJECTIVE
```text
Formal Specification + Code-Conformance Audit for MTF Alignment.
Question answered:
Does the current SniperGold implementation genuinely implement the intended
H4 Narrative -> M30 Context -> M15 Entry -> M3 Price Action hierarchy, with
correct timestamp alignment, timeframe semantics, and cross-timeframe
consumption?
Answer (VERDICT): PARTIALLY CONFORMING
The four role labels ARE implemented with the correct timeframe assignments
(H4=N, M30=C, M15=E, M3=P) and the per-slot closed-bar/as-of handling is
sound (CONFORMING). What is NOT implemented is a genuine multi-timeframe
SEMANTIC hierarchy: the decision model is a FLAT weighted vote of four
independent, role-labeled, same-detector-per-TF agents with NO cross-timeframe
structural references (S-R), NO defined conflict policy (S-X), and a
training/runtime surface that uses a DIFFERENT MTF model (D1/H4/H1/M15).
Questions NOT answered: profitability / AUC / PF (semantic audit only).
Human verification = CANCELLED. No production code changes. No ML / repair.
```
---
## 2. SOURCE RECONCILIATION (17 sources)
```text
1 AFEngine1MTF (Register/Refresh/Build/IsBarClosed) AF_Engine1_MTFData.mqh
2 AF_E2_TF_S1..S4 = H4/M30/M15/M3 AF_Defines.mqh:47-50
3 AFAgentNarrative::Compute (H4, slot S1) AF_Engine2_Agents.mqh:430-490
4 AFAgentContext::Compute (M30, slot S2) AF_Engine2_Agents.mqh:492-575
5 AFAgentEntry::Compute (M15, slot S3) AF_Engine2_Agents.mqh:583-663
6 AFAgentPriceAction::Compute (M3, slot S4) AF_Engine2_Agents.mqh:665-745
7 AFAggregator::Compute (2-pass weighted vote) AF_Engine2_Aggregator.mqh:77-170
8 AFEngine2Signals::Compute (facade) AF_Engine2_Aggregator.mqh:183-199
9 AF_BuildDisplayData (sDisp/sD1/sW1) AF_Engine2_Display.mqh:308-395
10 AF_Engine3_Display.mq5 OnCalculate (driver) Indicators\AlgoForge\
11 AlgoForge_Backtest_Baseline.mq5 (ML path, NO Eng2) Experts\AlgoForge\
12 build_features.py / train_model.py (M15 + D1/H4/H1) ml\
13 FEATURE_CONTRACT.md (D1/H4/H1 + M15; E_ea as-of) docs\
14 v4.5 legacy (D1/H4/H1 structure + M15) Indicators\Downloads\
15 v4.3/v4.4 legacy (M15 + TFBias D1/H4/H1) Indicators\Downloads\
16 P3-S.2..S.6 specs (canonical TF statements) docs\
17 ml/parity/RUNTIME_TRAINING_PARITY_REPORT.md (SB-06) ml\parity\
```
**Core findings (brief):**
```text
1. The 4 agents are independent and each reads EXACTLY ONE slot; the SAME
detector suite (AF_DetectSweep/Choch, AF_FindOrderBlock/FVG, AF_RangeStat,
AF_BuildSwing) runs per-TF. Role differentiation exists only at agent
composition + labels, not in the detectors, and there is NO cross-TF
structural reference anywhere (S-R).
2. The aggregator is a FLAT weighted vote (0.30/0.30/0.25/0.15) + 1.5x majority
boost. ANY single timeframe can produce a final BUY/SELL (verified
arithmetically and by unit test T6; MTF-T19/T20/T22). No stage is REQUIRED;
no stage gates another (S-A / S-H). -> HIERARCHICAL-TO-VOTING DRIFT (D-1)
relative to a strict-hierarchy reading; per DESIGN.md the vote IS the design.
3. Conflict policy: NONE defined; contradictions resolve arithmetically
(S-X / D-2) -> SPECIFICATION AMBIGUOUS.
4. As-of: Engine-1 closed-bar lock per slot is CORRECT; H4/M30/M15/M3_asof(t)
<= t holds by construction; HTF-close visibility is deterministic (S-T,
MTF-T07/T08/T10/T16).
5. Two MTF models coexist: Engine 2 = H4/M30/M15/M3; Feature Contract/training/
ML runtime = D1/H4/H1/M15. The agent path has NO Python counterpart
(PARITY = N/A BY ABSENCE) -> FEATURE_CONTRACT MTF MISMATCH (D-5).
6. Display shows M15 structure/zones + D1/W1 levels + agent biases; H4/M30
structures are NOT drawn (V-1..V-4, D-4).
7. Cross-concept timeframe inconsistency (D-6 / X-1..X-5): f7/f8/f9 M15-only
(contract) vs per-TF Engine 2 vs legacy D1/H4/H1; FVG/OB/Displacement
multi-TF without a canonical TF.
```
---
## 3. SPECIFICATION (docs/SMC_MTF_ALIGNMENT_SPEC_v1.md)
```text
S-N H4 = Narrative directional VOTE (0.30); CAN trigger entry alone; NO gate/
override/invalidate.
S-C M30 = Context zone VOTE (0.30); can trigger alone; NO filter on M15.
S-E M15 = Entry VOTE (0.25) + internal ZONE + CONFIRMATION rule; contradiction
NOT blocked.
S-P M3 = Price Action VOTE (0.15); timing role; NOT mandatory; no override/
rejection.
S-H Hierarchy = top-down ANALYSIS order; DECISION = flat vote; no REQUIRED
stage.
S-D Direction = 2-pass weighted vote; 1.5x majority boost; bias 0.20 /
support 0.50.
S-X Conflict policy = NONE (SPECIFICATION AMBIGUOUS; arithmetic resolution).
S-T As-of = closed-bar lock per slot; H4/M30/M15/M3_asof(t) <= t; HTF-close
visibility deterministic.
S-A Aggregation = SAME-LEVEL VOTES; hierarchical gate NOT implemented.
S-R Cross-TF references = NONE (confluence only at vote level).
S-I No implicit TF substitution; explicit per-slot contract via macros;
runtime TF-identity by convention (unverifiable).
S-V Display = M15 structure + D1/W1 levels + biases; H4/M30 structure not drawn.
S-PR Parity = ML path (D1/H4/H1/M15) parity-verified; agent path N/A by absence.
S-XC Cross-concept = 5 concepts / 3 MTF models; no unified canonical TF.
S-ST Stale state = agent path stateless; no stale HTF consumption by construction.
```
---
## 4. CONFORMANCE (docs/P3_S7_MTF_ALIGNMENT_CONFORMANCE.md)
```text
H4 role : CONFORMING (narrative vote, 0.30; S-N)
M30 role : CONFORMING (context vote, 0.30; S-C)
M15 role : CONFORMING (entry vote, 0.25 + ZONE+CONF; S-E)
M3 role : CONFORMING (price-action vote, 0.15; S-P)
Hierarchy : PARTIALLY CONFORMING (analysis order yes; decision
hierarchy absent — D-1)
Timestamp semantics : CONFORMING (closed-bar as-of per slot; S-T)
Cache alignment : CONFORMING (explicit slot-TF contract; D-3 note)
Conflict policy : SPECIFICATION AMBIGUOUS (no policy; D-2)
Aggregation : PARTIALLY CONFORMING (flat vote per design; drift vs
strict hierarchy — D-1)
Consumer semantics : CONFORMING (stateless; no stale; no cross-TF refs)
Cross-concept consistency : NON-CONFORMING (three MTF models; D-6)
Runtime/training parity : PARTIALLY CONFORMING (ML path verified; agent path
N/A by absence; contract mismatch D-5)
Display consistency : PARTIALLY CONFORMING (V-1..V-4; D-4)
VERDICT : PARTIALLY CONFORMING
The role labels and per-slot as-of handling conform; the genuine
multi-timeframe SEMANTIC hierarchy (cross-TF references, defined conflict
policy, single canonical MTF model) is not implemented.
```
---
## 5. SYNTHETIC TESTS — 22/22 PASS
```text
spec_tests_mtf_alignment.py + spec_test_cases_mtf_alignment.json
+ output/spec_tests_mtf_alignment_report.json
MTF-T01..T22 all pass; code_port == spec in ALL cases (the implementation
conforms to the project's flat-vote model); structural facts verified:
e_agent_single_slot=True agents_stateless=True aggregator_flat_vote=True
engine1_closed_bar_lock=True hardcoded_tf_macros=True
tf_identity_by_convention=True
Notable expectations: MTF-T02 exact H4/C tie -> WAIT; MTF-T14 E-bear vs P-bull
-> WAIT (bias 0.197 < 0.20); MTF-T19/T20/T22 single-agent permissiveness;
MTF-T21 H4 bull + M15 bear -> BUY (arithmetic, no conflict block).
```
---
## 6. CONFIRMED FINDINGS (document-only)
```text
D-1 HIERARCHICAL-TO-VOTING DRIFT [MEDIUM] — flat vote vs strict-hierarchy
reading; not adjudicated (A-2).
D-2 CONFLICT POLICY UNDEFINED [MEDIUM] — no BLOCK/WAIT/OVERRIDE; arithmetic
resolution (A-1).
D-3 RUNTIME TF-IDENTITY BY CONVENTION [LOW] — slot->TF not re-checked at
consume time (MTF-T11).
D-4 DISPLAY VS DECISION INCONSISTENCY [LOW] — V-1..V-4.
D-5 FEATURE_CONTRACT MTF MISMATCH [MEDIUM] — Engine 2 H4/M30/M15/M3 vs
contract/training/ML D1/H4/H1/M15.
D-6 CROSS-CONCEPT TIMEFRAME INCONSISTENCY [MEDIUM] — X-1..X-5.
D-7 SAME DETECTOR vs DIFFERENT ROLE [INFORMATIONAL] — MTF ROLE DIVERGENCE.
NO stale-HTf-state bug in the agent path (stateless; f7/CHoCH/FVG/OB stale
class does not apply).
```
---
## 7. AMBIGUITIES
```text
A-1 Conflict policy (D-2) — not adjudicated.
A-2 Strict-hierarchy intent (D-1) — brief's decision-chain vs DESIGN.md flat
vote; not adjudicated.
A-3 Canonical concept TF (D-6) — three MTF models.
A-4 Runtime TF-identity enforcement (D-3) — by convention.
```
## 8. NO PRODUCTION CHANGE — only P3-S.7 artifacts added; 0 production files modified.
## 9. NEXT GATE: P3-S.8 Candidate Setup (no consolidated repairs; no ML until
the semantic audit chain completes).
## 10. ARTIFACTS
```text
docs/SMC_MTF_ALIGNMENT_SPEC_v1.md
docs/P3_S7_MTF_ALIGNMENT_CONFORMANCE.md
ml/p3/smc_semantic/spec_tests_mtf_alignment.py
ml/p3/smc_semantic/spec_test_cases_mtf_alignment.json
ml/p3/smc_semantic/output/spec_tests_mtf_alignment_report.json
docs/SESSION_HANDOVER_2026-08-22_P3_S7_MTF_ALIGNMENT.md (this document)
```
## 11. COMMIT & PUSH STATUS
```text
NOT YET COMMITTED at handover write time.
Planned message:
research: P3-S.7 MTF Alignment formal spec + conformance audit (PARTIALLY CONFORMING)
```