How to Backtest an EA on MT5: Every Step, and the Four Numbers That Lie

Key takeaways
- The MT5 Strategy Tester is free and already installed — View → Strategy Tester, or Ctrl+R. The hard part is not running it, it is knowing which of its numbers to ignore.
- Set Modelling to Every tick based on real ticks and check the modelling quality line. Anything built on M1 OHLC will flatter an intrabar strategy badly.
- Never trade an optimisation result straight out of the tester. When I optimised 129 settings on half of 16,926 EURUSD 5-minute bars, the champion made +519.6 pips in-sample and +4.4 out-of-sample.
- The two report fields that decide everything are total trades and spread. Charging one pip a trade cut the share of profitable settings from 67.2% to 21.1%.
Backtesting an EA on MT5 takes about ten minutes to learn and considerably longer to learn to distrust. This guide walks the actual clicks — data, settings, forward period, report — and marks the four places where the tester will hand you a number that is not what it looks like.
Where is the Strategy Tester in MT5?

- Open MetaTrader 5 and press Ctrl+R, or use View → Strategy Tester. It opens as a panel at the bottom of the terminal.
- In the Overview tab pick your Expert Advisor from the dropdown. Anything in MQL5/Experts appears here; if yours does not, compile it once in MetaEditor with F7.
- Choose the Symbol and the Period — the timeframe your EA runs on, not the one you like looking at.
- Set the date range. Use whole months and end it well before today, because you will need untouched recent data later.
- Set Deposit and Leverage to match your live account, and set Forward to No for the first run.
- Press Start. The Graph tab draws the equity curve, the Results tab lists trades, and the Backtest tab holds the report you will actually read.
MT4’s tester is the same idea with fewer options and a worse modelling engine; if you are still deciding between platforms, my MT5 indicator guide covers where the menus differ.
Which tester settings actually change the result?

| Setting | Use | Why it matters |
|---|---|---|
| Modelling | Every tick based on real ticks | The only mode that uses the broker’s stored ticks. “1 minute OHLC” invents four prices per minute and will make any intrabar stop or target look better than it is. |
| Delays | Random delay | Zero latency is not a market condition. Random delay is the closest thing the tester offers to reality. |
| Spread | Current, then re-run with a fixed worse value | This is the single biggest lever in the report. Test it twice, deliberately. |
| Optimisation | Disabled for the first run | Look at one honest run before you look at ten thousand flattering ones. |
| Deposit and leverage | Your real ones | Position sizing changes drawdown, and drawdown is what stops you in practice. My position sizing table has the arithmetic. |
After the run, check the modelling quality percentage at the top of the report. Below about 90% the tick data has gaps and the trade-by-trade detail is fiction. Download history first: View → Symbols, select the symbol, then the Ticks tab and Request.
How do I read the backtest report without fooling myself?
The report puts profit at the top, which is the least informative field on the page. Read it in this order instead.
| Field | What to look for |
|---|---|
| Total trades | Under 30 and there is nothing to conclude. This is the first field I look at, always. |
| Expected payoff | Profit per trade. Convert it to pips and compare it to your spread. If it is smaller, the strategy is a cost generator. |
| Profit factor | Above 1.5 on 30-plus trades is interesting. Above 3 on 12 trades is noise. |
| Maximal drawdown | The number you will actually experience. Double it in your head before believing you could sit through it. |
| Equity curve shape | One vertical jump means one lucky trade carries the system. In my walk-forward run, 108% of the profit came from a single window. |
Why should I never trade an optimisation result directly?
This is the part the tester makes easy and the market makes expensive. Switch Optimisation on and MT5 will search every combination you allow and rank them by profit. That ranking is generated from data the settings were chosen on, which makes it a report about the past rather than an estimate of the future.
I measured the size of that gap. Using 16,926 EURUSD 5-minute bars, I optimised 129 parameter sets on the first half and then ran each winner on the second half, which the selection never touched.
| Best setting found on history | In-sample pips | Out-of-sample pips |
|---|---|---|
| Bollinger 20, 2.0 SD | +519.6 | +4.4 |
| RSI 9, level 20 | +447.7 | -156.6 |
| MA 5/150 | +193.6 | +106.3 |
| Donchian 100 bars | -102.0 | +100.1 |
Across all 128 usable settings, the rank correlation between the two halves was 0.063 — the backtest ranking carried essentially no information about the out-of-sample ranking. The full method and the walk-forward results are in my in-sample versus out-of-sample test, and the head-to-head against textbook settings is in optimised versus default settings.
How do I use the Forward field to hold data back?
MT5 has the fix built in and almost nobody switches it on. In the Settings tab, Forward splits your date range automatically.
- Set Forward to 1/2 or 1/3. The tester optimises on the earlier portion only.
- Run the optimisation. When it finishes, open the Forward Results tab — not the Optimisation Results tab.
- Sort the forward tab by profit and find where your in-sample champion sits. In my run, the best in-sample setting ranked 9th on average in its family on the unseen half.
- Only consider a setting that is profitable in both tabs. In my grid, 52.3% of settings were profitable in-sample and 67.2% out-of-sample, but only 37.5% in both.
- Prefer a setting whose neighbours also work. A lone peak in the optimisation grid is a hole in the sample, not an edge.
What does spread do to a backtest?
More than any setting in your EA. Charging one pip per round turn — roughly the real EURUSD cost I measured in my spread and swap breakdown — the share of profitable out-of-sample settings fell from 67.2% to 21.1%, and my walk-forward sequence went from +95.0 pips to -193.0.
The mechanism is trade count, not accuracy. A rule taking 230 trades needs 230 pips just to reach zero. This is why the tester’s Total Trades field deserves more of your attention than its profit field, and why restricting trading to one session improved results in a completely separate test: fewer trades, same edge, far less rent paid to the spread.
A ten-minute checklist before you trust any backtest
- Real ticks, quality above 90%. Download the history first.
- At least 30 trades, ideally in each half of the period.
- Forward set to 1/2 or 1/3, and the forward tab read before the optimisation tab.
- Expected payoff bigger than your spread, checked in pips.
- Equity curve without one dominant jump.
- Settings whose neighbours also work — check the grid, not just the top row.
- Re-run once with a deliberately worse spread and see what is left.
Frequently asked questions
Is the MT5 Strategy Tester accurate?
The tick engine is accurate if you feed it real tick data and check that modelling quality is above 90%. What is not accurate is the interpretation: profit shown on the data used to pick the settings is a description of the past. On my 129-setting grid it overstated the out-of-sample result by a factor of four on average, and by a factor of 118 in the worst case.
How long a backtest period is enough?
Count trades, not months. Thirty trades is my floor for any conclusion, and I want that in each half of the period, not in total. Three months of 5-minute EURUSD gave 128 of my 129 settings at least 30 signals per half, which is why I use it.
What is the Forward setting in MT5?
It automatically reserves the later part of your date range, optimises on the earlier part, and reports the reserved part separately in a Forward Results tab. It is the single most valuable checkbox in the tester and it is off by default.
Can I backtest an EA on MT4 instead?
You can, but MT4’s tester models fewer ticks and handles multi-currency badly. If your strategy touches intrabar stops or targets, MT5 with real ticks will give a materially different — and more honest — answer.
Why did my optimised EA stop working on live data?
Most likely it never worked. In my test the grid champion kept 0.8% of its in-sample pips and one optimised setting flipped from +447.7 to -156.6. Re-run the optimisation with Forward set to 1/2 and look at where your live settings rank on the half they never saw. The full breakdown is in my optimisation test, and the underlying dataset also backs my stop distance test and news release test.
Want a clean indicator to install right now?
It is my own enhanced DeMARK Trend Line indicator for MetaTrader 4 and 5. Non repaint, clean, and free.

