Guide

MT5 Strategy Tester: how to backtest in MetaTrader 5

The Strategy Tester is built into MetaTrader 5. It runs an expert advisor over historical data and returns a report with profit, drawdown and every simulated trade.

Updated: 4 min readReviewed by Andrii Levchenko

The Strategy Tester runs expert advisors (EAs), the automated strategies written in MQL5. It does not replay the chart for manual trading. If your strategy is discretionary, see how to backtest a strategy by hand.

Open the tester

In MetaTrader 5, open View → Strategy Tester or press Ctrl+R. The panel opens at the bottom of the terminal. On the Overview tab choose Single test to run one EA once.

Settings that decide the result

On the Settings tab:

  • Expert. The EA to test. It must be in the Experts folder of the terminal.
  • Symbol and timeframe. Test on the symbol of the broker you will trade with. Contract sizes and spreads differ between brokers.
  • Date. Pick a period with different market conditions, not only the last strong trend.
  • Forward. Splits the period. The EA is tested on the first part and checked on the rest it has not seen. 1/3 or 1/4 is a common choice.
  • Delays. Simulates execution delay. Zero delay flatters scalping strategies, so add a realistic value.
  • Modeling. How the tester builds price movement inside each bar. See the next section.
  • Deposit and leverage. Use the account size and leverage you will trade with.

The EA's own parameters are on the Inputs tab.

Modeling modes

ModeWhat it usesWhen to use it
Every tick based on real ticksTicks recorded by the brokerFinal checks, scalping, tight stops
Every tickTicks generated from minute barsMost tests, faster than real ticks
1 minute OHLCFour prices of each minute barQuick checks of strategies with wide stops
Open prices onlyThe open of each barEAs that act only on a new bar
Math calculationsNo price dataPure calculations, not trading

The faster the mode, the less it knows about what happened inside a bar. If the stop and target can both be hit within one bar, only tick modes tell you which came first. Run the final test on real ticks when the broker provides them.

Optimization

Optimization runs the EA many times with different input values. On the Inputs tab, tick the parameters to vary and set start, step and stop. On the Settings tab choose the algorithm: slow complete tries every combination, fast genetic searches a large space in less time.

Optimization is where most backtests start to lie. With enough parameters, some combination always fits the past. Three habits help:

  • Vary as few parameters as possible.
  • Prefer a broad area of good results over one sharp peak.
  • Check the chosen values on the forward period. If results collapse there, the fit was to noise.

Read the report

After a run, open the Backtest tab. The numbers to read:

  • Total net profit. The result after the simulated costs.
  • Profit factor. Gross profit divided by gross loss. Below 1 means the EA lost money.
  • Expected payoff. Average result per trade. Positive is the minimum.
  • Equity drawdown maximal. The deepest fall from a peak, including open trades. This decides whether a prop firm account would have survived.
  • Total trades. Fewer than 100 makes every other number weak.
  • Recovery factor. Net profit divided by maximum drawdown.

The Graph tab shows balance and equity, and the Trades tab lists every deal. A smooth balance line with a jagged equity line means the EA holds losing trades for a long time.

Visual mode

Tick Visual mode to watch the EA trade on the chart in a separate window. Use it to check that entries match what you intended, not to measure performance.

From the tester to live trading

A good report is a reason to forward-test, not to go live with full size. Run the EA on a demo account or with minimal size for a few weeks and compare its expectancy with the test. Keep a trading plan for the EA too: maximum drawdown before you switch it off, and how often you review it.

Tradeart connects to MetaTrader 5 and imports the EA's live trades automatically, including trades opened by an expert advisor. Read more about the MT5 trading journal and how drawdown is measured.

Frequently asked questions

How do I open the Strategy Tester in MT5?

Open View → Strategy Tester in the menu, or press Ctrl+R.

Which modeling mode is the most accurate?

Every tick based on real ticks. It uses the broker's recorded ticks, so it shows the order in which stop and target were hit inside a bar.

Can I backtest manual trading in the MT5 Strategy Tester?

The tester is built for expert advisors. For a discretionary strategy, replay the chart bar by bar in a separate backtester and log the trades by hand.

Why are live results worse than the tester?

The usual reasons are spread and slippage the test did not model, zero delays, and parameters optimized to fit the past.

Start today

Your edge is
in your history.

Start free trial7 days free · No credit card