The MT5 Strategy Tester is one of the best free backtesting tools retail traders have: multi-currency, tick-level, with a built-in optimiser and the option to farm work out to a cloud network. It's also very good at producing beautiful results that don't survive contact with a live account. The difference is almost entirely in the settings.
Opening the Strategy Tester
In the MT5 desktop terminal: View → Strategy Tester, or Ctrl+R. Choose:
- Expert: the EA to test (indicators can be tested visually too).
- Symbol and timeframe: the EA's chart timeframe. The tester can still use tick data underneath.
- Date range: as long as you have reliable data for. More market regimes beat more recent ones.
- Modelling: how price is simulated (next section). This is the most important setting.
- Deposit and leverage: match the account you'll actually trade.
Then press Start. Results arrive in the Backtest, Graph and Journal tabs.
Modelling modes: pick "every tick based on real ticks"
MT5 offers several ways to simulate price inside each bar:
| Mode | What it does | Use it for |
|---|---|---|
| Every tick based on real ticks | Replays the broker's recorded tick history | Final tests of anything with stops, targets or intrabar logic |
| Every tick | Generates synthetic ticks from M1 bars | Quick tests when real ticks aren't available |
| 1 minute OHLC | Uses only open, high, low, close of each M1 bar | Rough checks of slower strategies |
| Open prices only | Evaluates only at each bar's open | EAs that genuinely only act at bar open |
| Math calculations | No price data at all | Pure computation, not trading |
"Every tick" mode generates ticks that follow a plausible path through each M1 bar, but it can't know whether price hit the high or the low first. For an EA with a 10-pip stop and 10-pip target inside a 15-pip bar, that's the difference between a win and a loss, and the tester picks a path for you. Real ticks remove the guess, at the cost of a slower test and a large download. The tester also reports a history quality percentage: on real ticks you want it close to 100%.
Spread, delay and commission: make them realistic
These are where optimistic backtests are made.
- Spread. The "current" spread setting uses today's spread for the whole test. That's wrong in both directions: too tight during news and rollover, sometimes too wide in quiet hours. Real-tick mode uses the recorded spread from the tick data, which is far closer to reality. If you must use a fixed spread, use a pessimistic one. The spread post shows how wide it gets.
- Delays. The tester can simulate execution delay ("Zero latency" or a random or fixed delay). Zero latency is the default and is never true live. Test with a delay, especially for scalpers; the slippage post covers the cost it represents.
- Commission and swap. These come from the symbol settings of the account the terminal is logged into. Test on a terminal logged into the account type you'll trade (raw-spread vs standard), or the costs will be wrong. The costs post explains each.
Optimisation without fooling yourself
The optimiser tries parameter combinations and ranks them, either exhaustively or with a genetic algorithm that searches large spaces faster. It's powerful and dangerous: with enough parameters, you can always find a set that fits the past perfectly and means nothing.
Ways to keep it honest:
- Use few parameters. Every parameter you optimise is another way to fit noise.
- Prefer broad plateaus to sharp peaks. If a stop of 30 pips is great and 28 and 32 are terrible, you've found noise. Good parameters have good neighbours.
- Use forward testing. MT5's optimiser can reserve the last part of the period (½, ⅓, ¼ or a custom date) as a forward period. Parameters are chosen on the earlier data and then run, untouched, on the forward data. If forward results collapse, the optimisation found noise.
- Check the number of trades. A result from 40 trades isn't a result. A few hundred is a start.
MT5 can also distribute optimisation across your local cores, remote agents you run, or the paid MQL5 Cloud Network, which helps for big parameter sweeps.
Reading the report
The Backtest tab is long. The numbers that matter most:
- Net profit vs maximal drawdown (equity drawdown, not balance). A strategy making 40% with a 35% drawdown is a very different thing from 40% with 8%.
- Profit factor (gross profit ÷ gross loss) and expected payoff. The profit factor post explains what good looks like.
- Recovery factor and Sharpe ratio. The Sharpe and drawdown post covers how they're calculated and their traps.
- Consecutive losses: the longest losing streak, which tells you what you must be able to sit through.
- The Graph tab: a smooth balance line with a jagged equity line underneath usually means floating losses are being held open. That's the signature of the strategies in the martingale and grid post.
Backtesting outside MT5
If your strategy isn't an EA, or you'd rather test in Python, you need the same historical data outside the terminal. With an account connected to MetaKit, the candles and ticks endpoints return the broker's own history, the same data the account trades on, ready for pandas; the historical data post shows how to pull it, including the 50,000-tick page limit and how to work around it. MetaKit doesn't run backtests itself; this is for feeding your own backtester the right data.
The real test: live vs backtest
Every backtest is a hypothesis. The test is whether live trading matches it. After a few weeks on a demo or small live account, compare:
- Win rate and average win/loss: close to the backtest, or not?
- Average slippage and spread paid: higher than the tester assumed?
- Trade frequency: if the EA trades far less live, the tester probably triggered on prices that don't occur in real execution.
If the account is connected to MetaKit, the performance endpoint returns win rate, profit factor, drawdown and the rest on the same definitions every time, which makes the live-vs-backtest comparison a weekly check rather than a spreadsheet project. When live and backtest diverge, believe live.