Backtesting & optimization in MetaTrader
Running a backtest on an EA
4 min
With an EA compiled, a backtest in MT5 is a matter of configuring the tester deliberately. Each choice shapes how trustworthy the result is.
The setup steps
- Select the EA and the symbol you intend to trade — an EA tuned on EUR/USD tells you little about gold.
- Choose the timeframe the EA operates on.
- Set the date range. Use a long span that includes different regimes: trends, ranges, and a crisis or two. A strategy that only survives a bull market is fragile.
- Pick the modeling mode — real ticks where possible (previous lesson).
- Set spread and costs to realistic values.
- Set the starting deposit and leverage to match your real account.
Inputs and reproducibility
The EA's input parameters are set in the tester's Inputs tab. Record exactly which values produced a given report. A backtest you cannot reproduce — because you forgot the parameters, date range or data source — is not evidence of anything.
Reading beyond the headline number
A large net profit with a 70% drawdown is untradeable in practice — you would have quit (or been margin-called) long before the recovery. Always read drawdown, the shape of the equity curve (smooth and rising, or one lucky trade?), and the trade count together. A clean profit factor on 600 trades across five years is worth far more than a huge return on 20 trades.
Remember what it is
Even a perfect, real-tick, cost-modelled backtest is hypothetical past performance. It tells you the strategy was not obviously broken historically. It does not promise a single dollar in the future.
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.