MetaTrader 5 · Strategy Tester

How to Backtest an Expert Advisor Properly in MetaTrader 5

A good backtest tries to break your strategy, not to flatter it. This is the process we use: realistic settings, the right metrics and the checks that expose overfitting.

By AliAkbar Kazeminia · Published October 4, 2026

Quick answer

To backtest an EA properly in MetaTrader 5: use the modelling mode Every tick based on real ticks; match deposit, leverage and symbol to your live account; include real spread and commission; test a long period covering different market regimes; judge results by drawdown, profit factor and trade count rather than net profit alone; check that nearby parameter values also work; validate on out-of-sample or forward data; and finish with a demo forward test.

Step 1: Set up the tester realistically

  • Modelling: choose Every tick based on real ticks for anything sensitive to intrabar movement. Faster modes are fine for early development, not for final validation.
  • Symbol and timeframe: the same symbol your broker offers and you will trade, with the same specification (digits, contract size, stops level).
  • Deposit and leverage: the same currency, size and leverage as the live account, otherwise lot sizing and margin behave differently.
  • Execution delay: add a realistic delay instead of instant fills.
  • Costs: commission and swap come from the account and symbol settings of the server you test on. If your live account charges commission and the demo does not, account for it manually.

Step 2: Choose a test period that is hard enough

Use as many years as the data allows, and make sure they include trends, ranges, high and low volatility and at least one shock event. Keep the most recent period aside; do not optimize on it. A strategy that has only been tested on its favourite year has not been tested.

Step 3: Read the right metrics

MetricWhat it tells you
Maximum equity drawdownThe deepest peak-to-trough loss, including open trades. Ask whether you could really tolerate it.
Profit factorGross profit divided by gross loss. Very high values on few trades are suspicious.
Expected payoffAverage result per trade; compare it with the spread and commission you pay.
Recovery factorNet profit relative to maximum drawdown; how efficiently the strategy recovers from losses.
Number of tradesSmall samples prove little. Look for enough trades that the result is not luck.
Largest lot and margin levelReveals hidden risk in grid, martingale and averaging systems.

Step 4: Test robustness, not just performance

  • Parameter neighbourhood: if changing a period from 20 to 18 or 22 destroys the result, the original value was probably noise.
  • Cost stress: repeat the test with wider spreads and extra slippage.
  • Other symbols and timeframes: a genuine edge usually shows up, weaker, on related markets.
  • Out-of-sample and walk-forward: optimize on one window, test on the next unseen window, and repeat across the history. The MT5 tester’s forward option gives a simple version of this.
  • Monte Carlo style checks: reshuffle trade order or skip a share of trades to see how fragile the equity curve is.

Step 5: Forward test before going live

Run the EA on a demo account for several weeks with the final settings, then compare its trades with a tester run over the same days. Differences point to execution, data or look-ahead problems. When the two agree, go live with a small size and scale up only after the live results are consistent with the tests.

Backtest checklist

  • Real ticks, realistic deposit, leverage, spread, commission and delay.
  • Several years across different market regimes.
  • Drawdown, trade count and lot size reviewed alongside profit.
  • Parameter and cost stress tests passed.
  • Out-of-sample or walk-forward validation passed.
  • Demo forward test matches the tester.

A backtest can show that a strategy would have worked in the past; it can never guarantee future profit. Trading leveraged products carries a high risk of loss.

Frequently Asked Questions

Which modelling mode should I use in the MetaTrader 5 Strategy Tester?

Use Every tick based on real ticks for final validation, especially for scalping, tight stops and breakout systems. Faster modes are fine for early development but can hide intrabar behaviour.

What metrics matter besides net profit?

Maximum equity drawdown, profit factor, expected payoff, recovery factor, the number of trades and the largest lot size or margin level. Together they show risk and robustness, which net profit alone does not.

What is walk-forward testing?

It means optimizing on one window of history and testing on the next unseen window, then repeating this across the data. It shows whether optimized settings keep working on new data instead of only fitting the past.

Need Your Strategy Backtested Professionally?

Send your EA, strategy rules or trade history on Telegram or use the contact form. The initial consultation is free.