How to properly test MT5 Expert Advisors

A backtest only tells the truth when the data, the testing mode and the cost model are realistic. This guide walks you through preparing MT5 for an honest backtest, running optimisation and forward verification, and interpreting the report so the live results match the test.

1. Why most backtests lie

Before clicking Start, understand what destroys a backtest:

  • synthetic ticks instead of real tick history;
  • zero or unrealistic spread and no commission;
  • over-optimised parameters fitted to one short period;
  • ignoring swaps, slippage and weekend gaps;
  • testing on a symbol or broker that doesn't match your live account.

A reliable test reproduces the live environment as closely as possible — same broker, same symbol specs, same costs.

2. Get real tick history

MT5 downloads the broker's ticks automatically when you test with "Every tick based on real ticks". To preload them, open View → Symbols (Ctrl+U) → Ticks tab, choose the symbol and range, and press Request. Load 2–3+ years for a serious test.

The tester journal reports the history quality for every run — aim for close to 100%.

Tip: Tick history depends on the broker. Test on the broker and account type you will trade on.

3. Open the Strategy Tester

View → Strategy Tester (Ctrl+R). Pick the EA, the symbol and the timeframe of the chart you'll use live. Don't mix timeframes between test and live — many EAs are timeframe-sensitive.

EA Quantum Lab builds skip the licence check in the tester, so they run without activation.

4. Choose "Every tick based on real ticks"

Modelling modes from worst to best:

  • "Open prices only" — for EAs that act only on a new bar;
  • "1 minute OHLC" — 4 prices per bar, useless for intrabar logic;
  • "Every tick" — generated from M1, OK for rough checks;
  • "Every tick based on real ticks" — the only mode that matches reality.

Always use real ticks for any EA that trades inside the bar (scalpers, breakout, grid).

5. Set period, deposit and leverage

Pick a continuous range of at least 2 years. Use the same starting balance, leverage and account currency as your real account: if you plan to trade $1,000 at 1:100, test exactly that, not $100,000 at 1:500.

Don't cherry-pick only good years — include a sideways period and a volatile one.

6. Configure spread, commission and slippage

Real ticks carry the broker's real spread. If you use a fixed spread instead, set it to your broker's average plus a buffer.

Commission comes from the symbol specification of the test account. On ECN accounts commission can eat 30–50% of a scalper's profit — a backtest without it is meaningless.

Tip: If your EA has a slippage input, add 1–3 points to simulate execution lag.

7. Run the test and watch the equity curve

Press Start and open the Graph tab: equity versus balance.

Warning signs:

  • equity dropping far below balance — large floating drawdowns (martingale or grid);
  • vertical jumps — a few huge trades distort the result;
  • a flat run of small wins, then one big loss — "picking up pennies in front of a steamroller".

8. Read the report — key metrics

In the Backtest tab focus on:

  • Net profit — absolute return;
  • Profit factor — gross profit ÷ gross loss; above 1.5 is decent, above 2 is good;
  • Recovery factor — profit ÷ max drawdown; above 3 is good;
  • Maximal drawdown (%) — above 30% is hard to trade emotionally;
  • Expected payoff — must exceed spread plus commission;
  • Sharpe ratio — above 1.0 is acceptable;
  • Total trades — fewer than 200 is statistically unreliable.

A huge profit with PF 1.05 and 60% drawdown is worse than a modest profit with PF 1.8 and 15% drawdown.

9. Optimisation — without overfitting

Set Optimization to "Slow complete algorithm" (exhaustive) or "Fast genetic based algorithm". In the Inputs tab tick the parameters to optimise and set Start / Step / Stop.

Rules:

  • optimise no more than 3–4 parameters at once;
  • use coarse steps (e.g. SL 20–80 step 10, not step 1);
  • rank by recovery factor or Sharpe, not net profit;
  • discard runs with fewer than 100 trades or drawdown above 40%.

Tip: If the best result is an outlier surrounded by losing variants, it's overfitted. Pick a set inside a stable plateau of good results.

10. Forward test — the honesty check

In the tester settings set Forward to 1/2 (or a custom date). MT5 optimises on the first part and then runs the best sets unchanged on the second part — data they have never seen.

  • Forward profit close to the backtest → robust;
  • forward profit much lower or negative → curve-fit, don't trade it;
  • forward drawdown twice the backtest → unstable risk.

11. Walk-forward analysis

For serious validation split the history into rolling windows: optimise on January–June and test July; optimise on February–July and test August, and so on. Join the forward results — that's the closest proxy for live trading.

In MT5 this is done by re-running the tester per window or with a third-party walk-forward tool.

12. Demo and live — the final confirmation

Even a perfect backtest isn't proof. Before risking real money:

  • run the EA for 2–4 weeks on demo with the same broker and leverage;
  • compare daily results with the tester for the same period;
  • start live with the minimum lot and 25–50% of the planned risk;
  • raise risk only after 1–2 months of stable live results.

If demo and live diverge sharply from the backtest, the cause is almost always spread, commission or slippage.

Tip: Keep a log of every parameter change.

Frequently asked questions

How much history is enough?

At least 2 years of real ticks covering both trending and ranging markets; 3+ years for scalpers. Less than a year is statistically meaningless.

My backtest shows 500% a year — why doesn't live work?

Almost always one of: generated ticks instead of real ones, zero spread or commission, overfitted parameters, or a symbol that doesn't match your live broker.

Profit factor 1.2 — trade it or not?

Borderline. Only if drawdown is small (under 10%), there are many trades (over 500) and a forward test confirms it. Otherwise wider live spreads turn it into a loss.

Can I trust a seller's backtest?

Treat it as a claim until you reproduce it with real ticks and your broker's costs. Our EAs have free demos on MQL5 Market and ready .set files, so you can check them yourself before buying.

Related guides

Failed to load the app

Something went wrong while loading. Try reloading the page — if the issue persists, clear your browser cache (Ctrl+Shift+R).