Backtesting & optimization in MetaTrader
The Strategy Tester and modeling quality
5 min
MT5 includes a built-in Strategy Tester that replays history through your EA so you can measure performance before risking money. Its quality depends entirely on the data and modeling mode you choose.
Modeling modes (most to least realistic)
- Every tick based on real ticks — replays actual recorded ticks from the broker. The most realistic and the one to trust, when the data is available.
- Every tick — generates ticks from minute (M1) bars using an interpolation model. Reasonable, but synthetic.
- 1 minute OHLC — uses only M1 open/high/low/close. Faster but coarse; intrabar order can be wrong.
- Open prices only — evaluates once per bar. Fast for slow strategies that only act on bar open, dangerously optimistic for intrabar ones.
Why modeling quality is make-or-break
The tester reports a modeling quality percentage. A strategy that uses stops and targets within a bar can look brilliant on coarse data — because the tester assumed a favourable intrabar path that never happened. The same EA on real ticks can be a loser. Scalping and intrabar strategies must be tested on real-tick data, or the result is meaningless.
The spread and cost settings
The tester lets you set the spread (use current or a realistic fixed value, not zero) and your symbol's commission and swap. As in Python, a backtest with no costs is a fantasy. Configure them to match your broker before trusting any number.
Reading the report
The tester outputs net profit, maximum drawdown, profit factor, the number of trades and an equity curve. Few trades over a short period prove nothing statistically — favour many trades across varied conditions before drawing conclusions.
This content is for educational and informational purposes only and is not investment, financial, tax or legal advice. Trading and investing carry risk, including the possible loss of capital. Any performance shown by third-party tools is hypothetical and not a promise of future results. Do your own research and consider professional advice before making any decision.