How to back-test an Expert Advisor properly in the MT4/MT5 Strategy Tester
By Praveen Divvala · · 5 min read
Short answer
To back-test an Expert Advisor properly, run it in the MT4 or MT5 Strategy Tester on good-quality historical data with realistic spread and slippage, test across several pairs, timeframes and market conditions, judge the result by drawdown and consistency rather than headline profit, then forward-test on a demo account before trading real money.
Start with data quality
A back-test is only as reliable as the price history behind it. Gaps and low-quality ticks can make a strategy look better or worse than it really is. MT5 can test on real ticks supplied by your broker, which is generally closer to live conditions than generated ticks. In MT4, modelling quality is often limited unless you import better history.
Model costs realistically
Spread, commission and slippage decide whether a strategy that looks profitable on paper survives live. A scalper or a tight-stop strategy is especially sensitive.
- Test with the spread your broker actually offers, not zero
- Include commission if your account type charges it
- Stress the result with wider spreads, because spreads widen around news
Test more than one market and period
One pair on one timeframe over one calm year proves very little. Run the EA across several pairs and timeframes and through different conditions: trending and ranging markets, high and low volatility. If it only works in one narrow slice, expect it to fail when conditions change.
Judge by drawdown and consistency
Net profit is the least useful number on its own. Look at maximum drawdown, the length of losing streaks, the profit factor, and how evenly returns are spread over time. A strategy with a smaller profit and a shallow drawdown is often easier to actually trade, and far easier to run on a prop firm account with loss limits.
Avoid over-optimising
Optimisation can find settings that fit past data perfectly and fail immediately on new data. Keep the number of tuned inputs small, prefer settings that work across a range of values rather than one sharp peak, and reserve a period of history the optimiser never saw to check the result.
Forward-test on demo before going live
A demo forward-test shows how the EA behaves in real time: order execution, requotes, spread spikes and broker quirks that a historical test cannot reproduce. Run it long enough to see several different market conditions before risking capital.
A note on expectations
Back-testing shows how a strategy would have behaved in the past. It does not guarantee future results, and no EA can promise profit.
General information about software and trading platforms, not investment advice. Trading leveraged products carries a high risk of loss. See the risk disclosure.

