trding.io

Trding.io Tutorial

How to Backtest a Trading Strategy on MetaTrader 5 (Strategy Tester)

By Michael · Head of StrategyPublished 2026-08-02

Backtesting in the MetaTrader 5 Strategy Tester lets you run an Expert Advisor or strategy against historical price data to see how it would have behaved before you risk real money. This tutorial walks you through opening the tester (View > Strategy Tester or Ctrl+R), selecting your EA, pair and timeframe, setting the modelling mode to 'Every tick based on real ticks' for maximum accuracy, defining the date range and deposit, running the test, and reading the key metrics: profit factor, drawdown and total trades. Crucially, it also explains what a backtest does NOT prove: a beautiful equity curve on historical data is not a promise of future profit, and the majority of retail traders still lose money.

Why backtest, and what it actually proves

A backtest replays your trading strategy against historical market data so you can see how it would have performed in the past, without spending a single real dollar. In MetaTrader 5 (MT5), this is done inside the built-in Strategy Tester, which can run Expert Advisors (EAs, i.e. automated strategies) and some indicators over months or years of price history in minutes.

A well-run backtest CAN prove useful things: that your strategy's logic executes without errors, roughly how often it trades, how large its historical drawdowns were, and whether its edge survived different market conditions. It is a filter to reject bad ideas cheaply.

A backtest does NOT prove that your strategy will make money in the future. Past price behaviour is not a contract for future price behaviour. It cannot fully model live-market realities like variable spreads, slippage, requotes, gaps, or your own emotions when real money is on the line. Treat a good backtest as necessary but nowhere near sufficient.

Before you start: what you need

  • MetaTrader 5 installed and logged in to a broker account (a demo account is fine for testing).
  • An Expert Advisor or a strategy compiled and visible in the Navigator panel under 'Expert Advisors'.
  • Historical price data downloaded for the symbol and timeframe you want to test (MT5 can download this automatically, but real tick data may need to be synced first).
  • A clear idea of the pair (symbol), timeframe, date range and starting deposit you want to test.

Step 1 — Open the Strategy Tester

In MetaTrader 5, open the Strategy Tester panel by clicking View > Strategy Tester in the top menu, or simply press Ctrl+R. A tabbed panel appears at the bottom of the terminal with several sub-tabs: Settings, Inputs, Agents, Journal and (after a run) Results, Graph and Report.

Step 2 — Select the Expert Advisor or indicator to test

On the Settings tab, use the 'Expert' dropdown to choose the EA you want to backtest. Only EAs that are compiled and present in the terminal's MQL5\Experts folder will appear here. If your EA is missing, make sure it compiled without errors in MetaEditor and restart MT5 if needed.

Note that the Strategy Tester is designed primarily for Expert Advisors. Testing a manual strategy or a raw indicator requires either an EA wrapper around that logic or using the visual mode to eyeball how the indicator behaved historically.

Step 3 — Choose the symbol (pair) and timeframe

In the 'Symbol' dropdown, select the instrument you want to test, for example EURUSD, XAUUSD or a specific CFD. Make sure it is exactly the symbol your broker offers, because spreads and contract specifications differ between brokers.

In the 'Period' dropdown, choose the chart timeframe your strategy operates on (M1, M5, H1, D1, etc.). This should match the timeframe the strategy was designed for — a strategy built for H1 will behave very differently if tested on M5.

Step 4 — Set the modelling mode for accuracy

Find the 'Modelling' (sometimes shown as 'Model') dropdown. This controls how precisely MT5 reconstructs price movement between candles, and it is one of the biggest factors in how trustworthy your result is.

For the most realistic test, choose 'Every tick based on real ticks'. This uses actual tick-by-tick data downloaded from your broker, giving the closest approximation to how prices really moved. 'Every tick' (generated ticks) is the next best option if real ticks are unavailable. Avoid the faster 'OHLC 1 minute' and '1 minute OHLC' style modes for any strategy that is sensitive to intrabar movement, stop-loss placement or scalping — they can produce misleadingly clean results.

  • Every tick based on real ticks — most accurate, uses real broker tick data.
  • Every tick — generated ticks, good when real ticks are not downloaded.
  • 1 minute OHLC / Open prices only — much faster but far less realistic; use only for rough logic checks.

Step 5 — Define the date range and starting deposit

Tick the 'Use date' box and set a 'From' and 'To' date range. Choose a period long enough to include different market regimes — trends, ranges, high and low volatility. A test covering only a few weeks of a single trend tells you almost nothing about robustness.

Set the 'Deposit' field to a realistic starting balance and select the deposit currency and leverage that match how you actually intend to trade. The leverage and deposit affect position sizing and margin, which in turn affect whether the strategy would have survived its worst drawdowns.

Step 6 — Configure inputs and run the test

Switch to the 'Inputs' tab to review and adjust the EA's parameters (lot size, stop-loss, take-profit, indicator periods, etc.). Leave these at sensible defaults for a first honest run rather than hunting for the 'best' numbers.

Optionally enable 'Visual mode' on the Settings tab to watch trades play out on a chart — slower, but excellent for understanding what the EA is actually doing. When you are ready, click the 'Start' button. MT5 will download any missing history, run the simulation, and populate the Results, Graph and Report tabs.

Step 7 — Read the results that matter

When the run finishes, open the 'Results' and 'Report' tabs. Do not fixate on total net profit alone — the balance of these metrics tells the real story.

  • Profit Factor — gross profit divided by gross loss. Above 1.0 means profitable historically; many robust strategies sit between 1.2 and 2.0. Very high numbers (e.g. 5+) on a short test often signal over-fitting, not genius.
  • Maximal Drawdown (and Relative Drawdown %) — the largest peak-to-trough drop in equity. This is your pain threshold; if you couldn't stomach it live, the strategy is not tradable for you regardless of profit.
  • Total Trades — how many trades the sample contains. A handful of trades is statistically meaningless; you generally want dozens to hundreds before any metric is trustworthy.
  • Expected Payoff, Sharpe Ratio and Recovery Factor — supporting measures of per-trade edge, risk-adjusted return and how quickly the account recovers from losses.
  • Modelling Quality — shown as a percentage; the higher, the more faithfully MT5 reconstructed price movement for this test.

Why modelling quality and data quality are critical

The Strategy Tester reports a 'Modelling Quality' percentage. This reflects how completely and accurately your historical data covered the tested period. Low modelling quality — caused by missing bars, gaps in tick data, or a coarse modelling mode — means MT5 was guessing at intrabar price movement, and your results are built on that guesswork.

Garbage in, garbage out applies absolutely here. A strategy that relies on precise stop-loss or take-profit hits, or on tight scalping entries, can look wildly profitable on low-quality data and then fall apart on real ticks. Always download real tick data for your broker's exact symbol, aim for high modelling quality, and be sceptical of any result produced on incomplete history.

The pitfalls that fool almost everyone

Most losing backtests are not honest failures — they are results that were quietly rigged, usually by accident. Watch for these traps:

  • Over-fitting / curve-fitting — tuning parameters until the strategy looks perfect on your test period. Such settings are memorised to the past and typically collapse in live trading. Prefer robust parameters that work 'well enough' across many settings over a single magic combination.
  • Too little data — testing on a few weeks or a single market condition. Test across years and across trends, ranges and crises so you see how the strategy behaves when the market changes.
  • Ignoring spread, slippage and swap — a backtest with a fixed tiny spread and zero slippage can turn a losing strategy into a 'winner'. Use realistic (or variable) spreads, account for slippage on entries and exits, and include overnight swap/rollover costs, especially for strategies that hold positions.
  • Confusing a backtest with a live result — historical simulation has no requotes, no broker execution delays, no widening spreads during news, and no emotional interference. Live performance is almost always worse than the backtest.
  • Look-ahead bias and repainting indicators — some strategies accidentally use information that would not have been available at the time, producing impossible results that never reproduce live.

Troubleshooting common issues

  • EA not appearing in the Expert dropdown — confirm it compiled with no errors in MetaEditor and lives in MQL5\Experts; restart MT5 to refresh the list.
  • 'No history data' or empty results — MT5 needs to download history; open a chart of the symbol, scroll back to force a download, or let the tester sync. For real ticks, ensure tick data has been downloaded for that symbol.
  • Low modelling quality percentage — switch the modelling mode to 'Every tick based on real ticks', re-download history, and make sure there are no large gaps in the data.
  • Test runs but places zero trades — check the Inputs tab (lot size, enabled settings), verify the date range actually contains data, and read the Journal tab for error messages about margin, symbol or trading permissions.
  • Results look 'too good to be true' — they usually are. Suspect over-optimistic spread settings, low-quality modelling, over-fitted inputs, or a repainting indicator, and re-test with realistic conditions.
  • Symbol not found — the exact symbol name must match your broker's (e.g. 'EURUSD.i' vs 'EURUSD'); pick it from the dropdown rather than typing it.

An honest final word

A clean backtest with a healthy profit factor, a survivable drawdown and hundreds of trades is a genuinely good sign — but it guarantees nothing. History does not repeat on demand, and even a robust edge can stop working when the market's structure changes.

The realistic path is: backtest honestly, then forward-test on a demo account, then trade tiny live size, scaling up only if real-money results hold up. Even then, understand the base rate — the large majority of retail traders lose money over time. Backtesting is a tool to lose less and think more clearly, not a shortcut to guaranteed profit. Never risk money you cannot afford to lose.

This tutorial is educational and is not financial advice. CFDs are complex instruments and come with a high risk of losing money. Most retail traders lose money.

Find my broker in 60s →