Tick Replay From File
An offline chart built from OHLC bars alone has already lost information: the exact sequence and timing of the ticks inside each bar, and the real spread that traded rather than a single number assumed for the whole period. If you have a genuine recorded tick file - from your own broker's tick history export, or from a Spread History Recorder style tool run over time - this EA lets you look at it and use it as it actually was, not as a model's guess at what a plausible tick sequence would look like. The EA loads the whole file into memory and plays it back on the chart through a small transport panel - Play/Pause, Step, Reset - either in real time, sped up by a chosen multiplier, or as fast as possible. Play speed is measured against the file's own recorded timestamps, not wall clock ticks of the chart it is attached to, so a session that took six hours to record can be reviewed in a minute at high speed while the relative pacing of quiet and busy periods is preserved. Because neither platform lets an EA override its own chart's live Bid/Ask, the replay does not try - strategy logic that wants to react to the replayed data reads it from OnReplayTick(), a plain callback that receives the exact recorded timestamp, bid and ask, completely decoupled from whatever the live feed on the attached chart is doing. The Export button does something different: it aggregates every loaded tick into OHLC bars at a chosen timeframe and writes two files - one in the standard format for History Center import, so the recorded sequence becomes a normal offline chart built from genuine ticks rather than a volatility model; and a second file recording each bar's average, minimum and maximum spread, the real cost data an OHLC-only chart format has no column to carry at all. Notes and limitations - The source file must already be sorted in ascending time order. An out-of-order file is detected and logged, but the replay still steps through it row by row rather than re-sorting it for you. - Timestamps are second resolution on both platforms (neither's datetime type has a sub-second component), so sub-second gaps between ticks recorded within the same second cannot be reproduced in the pacing, only their file order. - Replayed prices never touch the chart's own Bid/Ask - neither platform lets an EA override them. A strategy under test must read the replay through OnReplayTick(), which is an empty extension point by default. - The Export bars use Bid as the OHLC price basis; spread is captured separately in the companion spread file rather than folded into the OHLC columns, since the History Center import format has no spread column. - Loading very large tick files close to InpMaxTicksToLoad uses a correspondingly large amount of terminal memory; lower the cap on a memory-constrained machine.
Expert advisor · MT5 · v1.0 · Free
About Tick Replay From File
Tick Replay From File is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 8 settings, such as Tick file name, Use common folder and Max ticks to load. MQL source code included.
Files in the download: TickReplayFromFile.ex5, TickReplayFromFile.mq5, TickReplayFromFile.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Tick file name | TickReplay.csv | Recorded ticks: DateTime,Bid,Ask per line, MQL5\Files |
| Use common folder | false | Read/write in the shared Terminal\Common\Files folder |
| Max ticks to load | 500000 | Safety cap on ticks loaded into memory |
| Replay speed multiplier | 1.0 | 1.0 = real time, 10.0 = 10x, 0 = as fast as possible |
| Auto start | false | Start playing immediately once the file is loaded |
| Loop when done | false | Restart from the first tick after reaching the last |
| Export timeframe | PERIOD_M1 | Bar period used by the aggregation export |
| Export file name | Blank = auto-named from the tick file name |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Alerts · MT5 Expert Advisor · MQL5 Source Code