How to Backtest a Forex EA in MetaTrader 5 With Real Ticks, Spreads and Execution Delays
The most realistic standard MetaTrader 5 Strategy Tester setting for a price-sensitive retail forex Expert Advisor is typically ‘Every tick based on real ticks’ using the broker’s recorded tick data, with appropriate account, commission and execution-delay assumptions. It remains a simulation—not evidence that a robot will achieve identical live fills. Testing only at candle opens or with generated minute-bar ticks can miss intra-minute spread changes and may substantially overstate a short-horizon strategy’s quality.
This is a practical guide for traders reviewing an EA before risking real money. It goes beyond general backtesting theory by identifying the specific MT5 modeling modes, comparing their data limitations and designing a reproducible cost-sensitivity test. MetaQuotes explains that real-tick testing can capture spread changes within a minute, whereas generated-tick testing uses the spread associated with the relevant minute bar.
Fastest, sparse price observations
Simulates intermediary activity from minute bars
Uses recorded Bid and Ask history where supplied
No mode guarantees live queue position, market impact, rejected orders or future spread behaviour.
What the four common MT5 tick modes actually simulate
| Testing mode | Data assumption | Main limitation |
|---|---|---|
| Open prices only | EA logic primarily checked at bar opening | May miss intra-bar protective stop interactions or timing |
| 1 Minute OHLC | Synthesised open/high/low/close events within each minute | Does not reproduce full tick sequence or real intra-minute spreads |
| Every tick | Intermediate ticks generated from minute history | Ask uses minute-bar associated spread, not every historical real-time quote |
| Every tick based on real ticks | Broker-recorded tick data where available | Still historical, may contain gaps and omit real market impact or order-book priority |
The descriptions above are based on MetaTrader 5 Strategy Testing and its testing features. A faster test can be useful for an early code check, but not for making a live profitability claim. For exchange instruments, bars may use Last while actual trades execute using Bid/Ask; check the symbol and history provenance.
Set up a reproducible test instead of adjusting settings until it profits
- Choose the exact EA version and save its input file before looking at test results.
- Select the intended broker server, symbol and account-currency assumptions.
- Choose a start and end date that include normal, volatile and thin-liquidity sessions.
- Use real ticks when history quality permits, and record any missing portions.
- Set commission, swap/margin and delay assumptions consistent with the intended account; do not ignore these to make the result positive.
- Keep the first result in-sample and reserve later data as a genuinely unseen evaluation period.
- Export individual deals and the tester Journal for verification of costs and rejected order logic.
MetaQuotes documents that MT5 has No Delay, Random Delay and Fixed Delay testing options. No Delay assumes fills at requested prices without requotes under the documented test mode. Random Delay simulates varying response times but is not a measured estimate of a specific broker’s latency. The useful research question is how much an outcome changes under plausible execution delays, not which delay produces the highest backtest equity.
Worked example: 100 trades, one-pip cost difference
Imagine a fictional EUR/USD EA with 100 complete round-trip trades of 0.10 standard lot each, and a price-only gross result of +180 pips averaged in the same defined ‘pip per trade’ units. With an assumed effective all-in cost of 1.0 pip per trade, the net result is 180 − 100 × 1.0 = +80 pips. At 2.2 pips per trade, net result becomes 180 − 220 = −40 pips. The identical entry and exit signals switch sign solely because of a different cost assumption.
| Effective round-trip cost | Cost across 100 trades | Net from +180 gross pips |
|---|---|---|
| 0.8 pip | 80 pips | +100 pips |
| 1.0 pip | 100 pips | +80 pips |
| 1.8 pips | 180 pips | 0 pips |
| 2.2 pips | 220 pips | −40 pips |
This is a synthetic sensitivity analysis, not actual EA performance. If position sizes or the account’s pip values vary, convert each trade into a common account-currency P/L basis before aggregating; simply adding pips across unequal contracts can mislead. Avoid double-counting spread costs if the entry/exit price data already incorporate them.
What real ticks improve—and what they cannot fix
Recorded tick history helps reconstruct how Bid and Ask changed during a high-impact event. This matters for stops, pending orders, spread filters and scalping systems that operate inside a one-minute bar. MetaQuotes notes that tick data can be missing or inconsistent with minute bars; the tester Journal can report mismatched tick volumes and time intervals where Last prices were absent or Bid substituted.
Real historical ticks still cannot supply the actual queue position a live limit order would have received, the impact of sending an unusually large order, or whether a broker would reject a particular live order under rapidly changing constraints. They also cannot predict the next year’s execution environment. The execution model must be reviewed as a scenario assumption rather than treated as audited real performance.
A cost and execution stress-test matrix
Run the same frozen EA settings through multiple well-labelled scenarios: normal recorded spread, normal spread with added slippage, stressed news spread, extra commission, additional overnight financing, and slower execution. Preserve the same signal logic and market history to isolate each assumption. For a strategy with many small gains, reducing a simulated result by two pips per trade may be more informative than another round of parameter optimisation.
When increasing a cost assumption, apply it only once. In MT5 real ticks, spread is generally embedded through Bid/Ask execution and may also appear in reported performance; subtracting a separate ‘spread fee’ from prices that already crossed the spread would exaggerate costs. Explicit commission, conversion, swap and adverse-fill assumptions are distinct. Refer to why trades start negative and where net break-even lies.
Data leakage, overfitting and realistic out-of-sample evaluation
Do not revise EA inputs repeatedly against the same supposed holdout data and continue calling it out-of-sample. A good process fixes parameters using one historical window, evaluates on a previously unseen period, and records every experiment that was run. Multiple tested parameter sets increase the risk that a strong-looking backtest is the luckiest outcome rather than a repeatable trading edge.
The broader walk-forward optimisation guide explains the statistical design. Here the added operational requirement is that every out-of-sample period also uses documented broker tick coverage, spread assumptions and order validity. A result that ignores rejected requests is not a reliable picture of executable turnover.
What to save before claiming the EA test is credible
Archive the EA code/version, input settings, server, symbol specification, selected market-data dates, modeling mode, execution-delay settings, commission/swap terms, tester log, complete trade export, and both gross and net performance. Include simple figures such as median cost per trade, maximum drawdown, number of rejected requests and the proportion of trades entered during high-spread windows.
Note limitations explicitly: a perfect simulated fill at an open price is not real queue priority, an idealised one-minute spread is not tick-by-tick spread history, and a single favourable sample is not a guarantee. For a direct demo/live comparison process, see demo versus live execution differences.
Frequently asked questions
Is every-tick testing always accurate?
It offers more granular historical simulation than open prices, but generated ticks and real recorded ticks differ; even real ticks cannot model every live fill and market-impact factor.
Which MT5 mode uses broker-recorded spreads?
Every tick based on real ticks uses broker-supplied tick history when available, including time-varying Bid/Ask data.
Does MT5 Strategy Tester simulate slippage?
It supports execution-delay modeling; whether any resulting pricing behaviour resembles a specific live broker depends on the symbol, order execution setup and assumptions.
Why does my EA lose when spread is increased?
The strategy may have insufficient per-trade edge to overcome transaction costs, particularly if its average gain per trade is small.
Can I use only open prices for an EA with stops?
That mode is useful as a fast preliminary check but is often inadequate for logic that depends on intrabar stops, pending triggers or rapidly changing spreads.
Does a profitable real-tick backtest prove live profitability?
No. It is historical simulation subject to market changes, data gaps, code assumptions, overfitting and real execution risks.
Original documentation
- MetaTrader 5: real and generated ticks
- MetaTrader 5: strategy testing modes and delays
- MetaTrader 5: spread and execution simulation
- MetaTrader 5: tester journal and data quality
Educational material: All performance and cost figures are hypothetical; no specific EA profitability is asserted. Leveraged trading entails substantial risk and historical simulations do not predict future outcomes.
Stay Ahead of the Markets
Get market analysis, financial news and practical trading insights delivered straight to your inbox.