Specification
1) Execution Mode
-
Attach EA to any live chart → Open a setup dialog (Apply Settings).
-
On OK, EA:
-
Loads history for selected symbol(s)/date range,
-
Creates a synthetic custom symbol (e.g., REPLAY.XAUUSD ),
-
Builds a synthetic chart (offline-style) for the chosen start date,
-
Opens that replay chart and mounts all UI panels there.
-
-
All trading is simulated internally. EA blocks real trading (no OrderSend /server calls).
2) Data & Synthetic Symbol Engine
-
History source: broker/server history (and local cache). Missing bars auto-pull on first run.
-
Custom symbol series: EA creates/updates REPLAY.<SYMBOL> with rates/ticks for the selected date range.
-
Timeframe backbone: store M1 (or tick, if available) as master; aggregate on the fly for HTFs.
-
Session masks & range filters applied at build time; indexes prepared for quick jumps.
3) Replay Chart Lifecycle
-
Start point: user-defined “From” datetime; chart loads at that bar.
-
Playback controls (on chart): Play, Pause, Step (tick/bar), Jump (next session open/order touch/bookmark).
-
Speed: 1× → 100× + Turbo (frame skip); FPS cap to protect UI.
-
Auto-pause rules: price touches key level, risk breach, strategy signal, bookmark.
4) Timeframe Switching (on the fly)
-
All MT5 TFs available (M1…MN) on replay chart:
-
Either create multiple TF series for the same custom symbol,
-
Or aggregate master M1 into requested TF in real time.
-
-
Switching TF does not restart replay; time index stays synced.
5) Trade Simulation (No Broker Orders)
-
Trade Control Box (always visible, draggable):
-
Order types: Market Buy/Sell; Pending (Limit/Stop/Stop-Limit).
-
SL/TP inputs: price, pips, ATR-multiple; structure-aware (last swing).
-
Lot sizing: fixed, %equity, cash-risk, ATR-multiple; live lot preview.
-
On-chart edits: drag SL/TP & pending orders; snap to valid price steps.
-
Lifecycle: Partial Close (%/volume), Breakeven, Close All, Reverse, Scale-in/out.
-
Trailing: step, ATR, chandelier/swing, custom rule set.
-
Hotkeys: entry, BE, partial %, toggle trail, close all, TF switch.
-
-
Fill model: user-selectable (strict OHLC, next-tick, touch-through); slippage model (fixed/volatility-based).
-
Costs: spread, commission, swap—auto from broker or manual overrides.
6) Capital & Risk Model
-
Starting Balance: user-defined (e.g., 10,000) — internal sandbox equity (independent of live account).
-
Risk limits: daily/weekly DD caps, open-risk cap, per-trade max risk.
-
Session locks/news windows (optional) to block new trades in defined windows.
7) Sessions, Filters & Navigation
-
Sessions: Asia, London, NY, lunch; include/exclude toggles + visual shading.
-
Date presets: 1W, 1M, 3M, YTD, Custom.
-
Skip idle: fast-forward low-volatility/filtered windows.
-
Bookmarks: add labels, jump quickly; auto-pause on bookmark (optional).
8) Strategy Presets & Layout Persistence
-
Save/Load profiles: indicators, risk template, costs, sessions, panel layout, hotkeys, drawing visibility.
-
Export/Import JSON under \MQL5\Files\ReplayEA\Presets\ .
-
Auto-save state on interval/events; crash recovery restores last context (time cursor, open “virtual” orders, panels, zoom).
9) Charting, Indicators & UI
-
Panels: Playback Bar, Trade Box, Orders/Positions Grid, Live P/L mini-card, Notes/Tags sidebar — draggable & resizable.
-
Drawing kit: S/R lines, zones/rectangles, trendlines, FVG/OB rectangles (pure chart objects, no repainting).
-
Helpers (toggle): VWAP, session opens, weekly separators.
-
Themes: light/dark; font scaling; compact/expanded density.
-
Keyboard help overlay (press H ) + tooltips.
10) Analytics & Reporting (Local-Only)
-
Auto-journal: per trade entry/exit, SL/TP, size, MAE/MFE, time in trade; screenshots (entry/exit/bookmark).
-
KPIs: Net P/L (currency & R), Win-rate, Expectancy, Profit Factor, Avg R, Max DD abs/%, equity curve, R distribution.
-
Breakdowns: by session, weekday, symbol, strategy preset, tag.
-
Exports: CSV/HTML under \MQL5\Files\ReplayEA\Reports\ .
-
Reproducibility stamp: version, symbol/TF, data range, engine/build in reports & screenshot footer.
11) Optimization & What-If (Optional)
-
Parameter sweeps: risk %, SL method, trailing style, session filters (run sequentially inside replay engine).
-
Walk-forward workflow: user defines IS/OOS blocks; engine runs them back-to-back and aggregates a summary.
12) Reliability, Safety & Performance
-
Deterministic playback: seeded randomness where applicable; environment logged.
-
Safety: hard block any live trading functions; show banner “SIMULATION ONLY”.
-
Performance guard: FPS cap, object throttling, lazy drawing for dense objects/long history.
13) Folder Structure (All Local, No DLL)
14) Setup Flow (User UX)
-
Attach EA → Setup Dialog opens.
-
User picks: Symbol(s), Date Range, Starting Balance, Costs model, Sessions, Fill model, TF list, Theme, Hotkeys.
-
Apply Settings → OK → EA builds/updates REPLAY.<SYMBOL> , opens the Replay Chart at start time, mounts UI panels.
-
User plays/simulates; can switch TF anytime; trade via Trade Box; journal auto-records; reports exportable.
15) Acceptance Criteria (Live-Mode Focus)
-
Apply Settings ke baad synthetic replay chart open ho aur specified date se bars load hon.
-
All TF switching (M1…MN) during replay without restart; time index remains in sync.
-
Trade Control Box: market/pending, SL/TP, drag-modify, partials, BE, trailing, reverse, scale-in/out + hotkeys — all simulated correctly, no real orders.
-
Internal equity & P/L accounting accurate with chosen costs/fill model.
-
Sessions/Skip idle work & visibly marked; jumps/bookmarks function.
-
Profiles + Auto-save/Recovery restore full state (cursor, orders, panels).
-
Analytics/Reports (CSV/HTML + screenshots) complete, consistent, reproducible.
-
Performance guard keeps UI responsive on typical hardware.
-
No external DLLs; all artifacts under \MQL5\Files\ReplayEA\... .
16) Deliverables (Required)
-
Pre-testing proof EA file ( .ex5 ) that runs in live terminal (no Tester) and opens the synthetic replay chart with all core features.
-
Complete, well-commented source code ( .mq5 ) — modular structure (Data Loader, Custom Symbol Engine, Playback Controller, Order Simulator, Risk/Accounting, UI Panels, Reporting, Persistence).
-
User Guide (PDF) with setup steps (Apply Settings flow), hotkeys, workflows, troubleshooting.
-
QA Test Report (functional + non-functional test cases, results, known issues).
-
Sample Outputs (a couple of Presets JSONs, one CSV/HTML report, some entry/exit screenshots).