GHADIMI FINANCEGHADIMI FINANCE

Backtesting in the MetaTrader 5 Strategy Tester

The Strategy Tester is MetaTrader 5’s built-in tool for running an EA on past data. A good backtest shows weaknesses before real money is at stake; a bad one only builds false confidence.

By · GHADIMI FINANCE · about a 5-minute read

Opening it and the main settings

Open View → Strategy Tester (or Ctrl+R). On the Settings tab:

  • Expert: the EA to test.
  • Symbol and Timeframe: where the EA runs.
  • Date: the test period. A few weeks rarely covers different market conditions.
  • Deposit and Leverage: close to your real account.
  • Delays: execution delay; choose a random or fixed delay to be realistic.

Modelling modes

ModeWhat it does
Every tick based on real ticksMost accurate; uses the broker's real ticks and spreads. Slower and needs tick history.
Every tickTicks are simulated from M1 candles.
1 minute OHLCOnly the four prices of each M1 candle; fast, for first passes.
Open prices onlyOnly candle opens; only for EAs that decide at the start of a candle.

For an EA with tight stops, trailing or intra-candle management, only the tick-based modes give reliable results.

Make costs realistic

If you don't use real ticks, set the spread manually to a typical value (not the lowest). Commission on ECN accounts must be included too; see its effect in spread and commission.

Reading the report

  • Profit Factor: gross profit divided by gross loss.
  • Expected Payoff: the average result per trade.
  • Maximal drawdown (balance and equity): the deepest fall; equity includes floating losses.
  • Recovery Factor: net profit divided by maximal drawdown.
  • Number of trades: a few dozen trades can't tell you much about a strategy.

Look at the balance curve too: a smooth climb during one short period followed by a sharp fall suggests the strategy depends on particular market conditions.

Optimisation and the risk of overfitting

The Optimization tab tries parameters over ranges you set (complete or with the genetic algorithm). The main danger is finding parameters that only fit the past.

  • Use the Forward option: part of the period (say the last third) is kept aside as an out-of-sample test.
  • Prefer parameters whose neighbours also do well, not one lucky value.
  • The fewer the parameters, the lower the chance of overfitting.

After the backtest

A good backtest does not guarantee future results. The next step is running small on a demo or small live account and comparing results with the backtest. UMBRA runs in the Strategy Tester without a license key and opens test entries for demonstration, so you can see its position sizing and stop management before buying.

Try UMBRA free in the Strategy Tester. Get the EA file and run it in the tester without a key.

See UMBRA

FAQ

Which modelling mode is best?

Every tick based on real ticks is the most accurate, provided your broker has enough tick history. For a quick first pass, 1 minute OHLC is enough.

How many years should a backtest cover?

Enough to include different conditions (trends, ranges, high and low volatility) and enough trades. Several years of data is common for intraday strategies.

Why do live results differ from the backtest?

Real spreads and slippage, execution delay, data differences and overfitting. That is why forward testing and running small after a backtest are needed.

Related tools and articles

GHADIMI FINANCE products