Sign up with our partner broker and get free XAU/USD signals. JOIN US
LIVE MT5 BUILD 5830 LAST REV 2026-05-23
SESSION -- UTC --:--
SESSIONS
SYDNEY22:00–07:00 UTC
TOKYO00:00–09:00 UTC
LONDON07:00–16:00 UTC
NEW YORK12:00–21:00 UTC

Backtesting properly in the MT5 Strategy Tester

A profitable backtest is the easiest thing in the world to produce and the most dangerous result to trust. The Strategy Tester gives you the tools; whether you use them honestly is up to you.

PUBLISHED 2026-05-24 READING TIME 13 MIN MT5 BUILD 5830 CATEGORY TOOLS
Core warning: Backtest results overstate live performance for almost everyone. The question is not whether your EA will perform worse live than in backtest. It will. The question is by how much, and whether the live edge is still positive.

1. Opening the Strategy Tester

In MT5, press Ctrl+R or use View → Strategy Tester. The tester panel opens at the bottom of the terminal. There are several tabs and a lot of settings. The ones that matter:

SettingWhat it doesRecommendation
ExpertSelects the EA to testPick from the dropdown
SymbolThe instrument to test againstMatch the symbol you will trade live
PeriodTimeframeMatch your EA's primary timeframe
DateStart and end of the test windowUse at least 2 years for swing strategies, 1 year for intraday
ModellingHow ticks are simulatedEvery tick based on real ticks for serious tests
ForwardHolds out a portion of the date range for out-of-sample testUse this whenever optimising
OptimizationEnables parameter searchOff for single backtest, Genetic algorithm for optimisation

2. Modelling modes explained

MT5 offers three modelling modes:

2.1 Every tick based on real ticks

The gold standard. MT5 downloads actual tick data from the broker's history server and replays it tick by tick. Spreads, bid/ask sequences, and timing match real history. This is the only mode appropriate for any EA that cares about precise entries (scalpers, EAs that trade near spread cost).

Limitation: only available for symbols and date ranges where the broker has stored tick history. Older data or less-traded symbols may force you to lower-quality modes.

2.2 Every tick (generated)

MT5 generates synthetic ticks within each bar based on OHLC and a model. Faster than real ticks but the tick sequences are not real. Acceptable for EAs that only act on bar close, but the precise behaviour of stops, trailing logic, and partial fills will not match live conditions.

2.3 1 minute OHLC

Only the 1-minute open, high, low, and close are used. The tester does not simulate intra-bar ticks at all. Fast but only useful for EAs that genuinely never look inside a bar.

2.4 Open prices only

Even faster. Only the open of each bar of the chosen timeframe is considered. Acceptable for the very first sanity check on a higher-timeframe EA; not acceptable for any conclusion you would act on.

3. Spread settings

The Spread field in the tester defaults to "Current". This means the test uses today's typical spread for the symbol. If you backtest XAUUSD with a current spread of 25 points but historically the spread was often 80 points during news events, your backtest will overstate net profit.

Better practice: set spread manually to a conservative value at the higher end of typical historical spreads. For XAUUSD, 40 to 50 points is more honest than the current quiet-market value.

Best practice if you have access: use real tick spreads, which capture the actual bid/ask history. This is the default when modelling mode is "Every tick based on real ticks".

4. Commission

The tester lets you set commission per round-turn lot in deposit currency. Almost everyone leaves this at zero, which understates trading costs.

For an ECN account with $7 per round-turn lot on XAUUSD, set commission to 7 in the tester. The tester will deduct this from each trade. For a "commission-free" markup-based account, set it to zero (the cost is already embedded in spread).

5. The optimisation trap

Optimisation lets you sweep input parameters across ranges and find the combination that produces the best result. The Strategy Tester offers two modes:

  • Slow complete algorithm. Tries every combination. Guaranteed to find the global optimum within the search space. Slow exponentially with the number of parameters.
  • Fast genetic algorithm. Evolutionary search. Finds good combinations quickly but not necessarily the absolute best. Required when the parameter space is too large for full enumeration.

The trap is simple. If you sweep 5 parameters across 10 values each, you have 100,000 combinations. The Tester will find a combination that looks excellent in backtest. Almost always, that combination is curve-fit to historical noise. The "best" result tells you nothing about future performance.

6. Walk-forward analysis

The honest way to use optimisation is walk-forward. The idea: divide your data into multiple periods. Optimise on period 1, test the optimal parameters on period 2 without further tuning. Move forward: optimise on periods 1-2, test on period 3. And so on.

If the parameters that look optimal on past data continue to work on the next unseen period, you have evidence of a real edge. If each optimisation finds different "optimal" values and forward performance is mediocre, you are looking at noise.

MT5 has a built-in Forward optimisation option. When you enable Forward and set its percentage (e.g. 25%), the tester optimises on the first 75% of the date range and reports forward results on the last 25%. This is a one-shot walk-forward; for multi-step walk-forward you run multiple separate tests.

7. Reading the report honestly

The Strategy Tester report contains many metrics. The ones that matter, in priority order:

MetricWhat it tells youWhat to look for
Total net profitOverall profit in deposit currencyPositive is necessary but not sufficient
Profit factorGross profit divided by gross lossAbove 1.3 for swing, above 1.5 for intraday is encouraging
Maximum equity drawdownLargest peak-to-trough declineCompare to expected real-account tolerance
Number of tradesSample sizeNeed 100+ trades for any statistical confidence
Sharpe ratioRisk-adjusted returnAbove 1.0 is decent for a public-market EA; very high values often indicate overfit
Recovery factorNet profit divided by max drawdownHigher is better; 3+ is strong

8. Signs the backtest is overfit

Patterns that suggest your result will not survive live trading:

  • Extreme profit factor (above 3 or 4). Real edges rarely sustain profit factors that high. Suspect data snooping.
  • Few trades (under 50). Tiny sample size. Almost any result is plausible from chance alone.
  • Specific parameter values that produce miracle results adjacent to terrible results. If MA period 23 makes the EA print money but MA period 22 and 24 lose, you have fit to noise.
  • Performance concentrated in a few outsize trades. Remove the best 5 trades and the EA is unprofitable: the "edge" is luck.
  • Equity curve perfectly smooth. Real edges have drawdowns. Curves with no losing streaks have usually been parameter-fit until losing streaks vanish.
  • Forward test underperforms in-sample dramatically. Self-explanatory. The classic overfit signature.

9. Honest backtest workflow

An end-to-end process that minimises self-deception:

  1. Decide your strategy logic before you write any code. Document entry, exit, risk, and any parameters.
  2. Code the EA. Compile cleanly. Run a single backtest on a recent period with reasonable parameters to confirm it does what you think.
  3. Choose a long historical period (e.g. 4 years). Reserve the most recent 25% as a forward test window. Do not look at it.
  4. On the remaining 75% (in-sample), run optimisation. Find the parameter combination that performs robustly across the range, not just the peak.
  5. Lock those parameters. Run a single test on the forward (out-of-sample) window. This is the test that matters.
  6. If forward test is positive and consistent with in-sample, consider running on a demo account in real time for 1 to 3 months before risking real money.
  7. If forward test underperforms, go back to step 1. Do not "improve" the EA by adjusting parameters until forward test passes; that converts forward into in-sample.

10. The Monte Carlo question

Even an out-of-sample positive result has uncertainty. Monte Carlo analysis simulates many alternative trade sequences (by reshuffling the order of historical trades) and reports the distribution of outcomes. MT5 does not include this natively, but several third-party tools accept Strategy Tester output and run Monte Carlo.

The output gives you a confidence interval: with 95% confidence, the maximum drawdown is between X and Y. This is more honest than the single drawdown number from one historical run.

11. What backtest cannot show you

Even a perfectly executed backtest hides several real-world frictions:

  • Slippage on stops. Real stops in fast markets execute at worse prices than the trigger.
  • Requotes and rejections. Some brokers reject orders during volatility. Backtests always fill.
  • Spread widening on news. Even with real tick spread, the broker's history may smooth over the worst spikes.
  • Server downtime and reconnection issues. Live EAs lose ticks, drop connections, restart. Backtests never have these.
  • Your own behaviour. When the live EA has a 20% drawdown, you may switch it off. The backtest assumes you let it run.

FAQ

How many years of data should I backtest over?

For strategies that hold trades for hours or days, at least 2 to 4 years. Longer is better but markets change; very old data may not reflect current microstructure. For scalping strategies, 6 to 12 months of high-quality tick data is often more useful than 5 years of mediocre data.

Should I backtest on a demo account or with downloaded history?

The Strategy Tester uses downloaded history regardless of whether you point at a demo or live account. Both demo and live broker servers can provide tick history depending on configuration; some demos have less history.

My EA is profitable on EURUSD but not on GBPUSD. Is that meaningful?

Possibly. If the strategy logic should apply to both, asymmetric performance is a warning that one of the tests is curve-fit. Robust strategies usually generalise across similar instruments (with parameter adjustments).

What modelling quality does the tester report?

For tick-based modelling, the report shows "99% (real ticks)" when full tick data is available. Lower percentages indicate missing tick data filled with synthetic ticks. Aim for 99% real ticks for any EA you might trade live.

Can I trust an EA that has only been backtested, never traded live?

No. Backtests are necessary but not sufficient. Forward testing on a demo for at least one month is the minimum bar before risking real capital, and even then expect surprises.

// FOR EA DEVELOPERS

Manual trade ideas to validate against

We post live signals to compare against your backtests. Useful as an independent reference when evaluating whether your EA is performing rationally. Free for partner-broker clients.

See the signals →
FREE WITH PARTNER BROKER · disclosure