Specification
Fractal Multi-Timeframe Strategy (H4→M15→M2) — Developer Spec
AbstractThis document specifies a fractal trading workflow leveraging H4 for regime identification, M15 for Area of Value (AoV) location, and M2 for execution using CHoCH-based triggers. The goal is a robust, developer-friendly specification that minimizes ambiguity and matches the operational style already discussed (Liquidity → Order Block → FVG/Imbalance priority).
Scope & Constraints· Language: MQL5 (no AI/ML).
· Multi-timeframe (H4, M15, M2) and multi-symbol scanning supported.
· SMC core logic must be native if third-party indicators are not available in MQL5.
Development Notes1) Risk Baseline
2) SMC Indicator Integration — Attach or reproduce LuxAlgo SMC logic to track AoVs, BOS/CHoCH, OBs, Liquidity, and FVG/Imbalance. If a native MQL5 version is unavailable, implement an in-house SMC core with configurable parameters.
3) H4 Trendline Logic — Implement H4 trendlines inspired by the 'Trendline Chortkee' approach on TradingView (free). If a direct MQL5 port is not available, reproduce the methodology: swing pivots (n), minimum spacing, ATR-based noise filter.
4) Top-Left HUD — Display exactly one of these states at any time: • H4: Bullish & Impulsive Leg → M2: Buy • H4: Bullish & Pullback Leg → M2: Sell • H4: Bearish & Impulsive Leg → M2: Sell • H4: Bearish & Pullback Leg → M2: Buy
Strategy Logic (Summary)· H4: Find Main High/Low; detect BOS (body-close rule); classify phase: MAIN vs PULLBACK; set directional bias.
· M15: Map AoVs with priority: Liquidity → Order Block → FVG/Imbalance; swing breaks = alerts only.
· M2: Execute only with CHoCH on/near an AoV; optional candle confirmations (Pin/Engulf/Inside).
Entry Criteria· On/near AoV definition: distance ≤ 0.3–0.5×ATR(M15,20).
· Valid CHoCH: body-close beyond the origin high/low that formed the last opposing swing, plus 0.1×ATR(M15,20) noise buffer.
· Optional: IOB → CHoCH → retest of newly-formed FVG before entry (higher quality).
Exit / Close Management· Risk per trade: 1–1.5% equity; Initial SL behind structural invalidation on M2 + buffer = max(2×spread, 0.2–0.3×ATR(M2,14)).
· TP1 at 1.0–1.2R or first opposing AoV/liquidity on M15; close 60–70%; move SL → BE+ after 1R or successful post-CHoCH FVG retest.
· Trailing Phase 1 (<2R): trail on M2 behind last confirmed swing; once-per-bar updates; min step = 0.5×ATR(M2,14); exit on reverse CHoCH on/near AoV.
· Trailing Phase 2 (≥2R or next M15 AoV): upgrade to M15 Swing Trailing or Chandelier Stop (Close − k×ATR(M15,20), k=2.3–2.8; use the farther stop).
· Full exit: H4 boundary touch (Main High/Low), or valid reverse CHoCH on M15 on/near AoV, or session cut-off, or SL hit.
Parameters (Default Values)· ATR periods: M2=14, M15=20; Chandelier k=2.3–2.8.
· Once-per-bar gates for signals/updates; timer interval 1–5s for scans; spread/slippage/margin guards.
· Session cut-off: configurable (e.g., no overnight/weekend).
Multi-Symbol & Platform Mechanics· Single EA can monitor multiple symbols via SymbolSelect/CopyRates; respect resource limits.
· HUD refresh once-per-bar; event logging for CHoCH detections (origin/time/price), entries, exits, and SL moves.
Glossary· AoV — Area of Value (Liquidity, Order Block, FVG/Imbalance)
· BOS — Break of Structure (body-close)
· CHoCH — Change of Character (body-close beyond origin)
· IOB — Internal Order Block
· R — Risk multiple (profit measured in units of initial risk)
Acceptance Criteria· EA compiles without errors/warnings; no AI/ML libraries used.
· HUD displays one of the four regime states correctly and updates once-per-bar.
· BOS/CHoCH detection follows body-close rule and origin logic; on/near AoV distance is configurable.
· Entry/exit logic behaves as specified in backtest (≥6 months) and forward test (session-based) with HTML reports.
Logging includes CHoCH origin, AoV tag, entries/exits, and SL moves; trailing adheres to once-per-bar + min step rule