How to backtest an EA in the MetaTrader 5 Strategy Tester

Run an Expert Advisor on past prices in MT5, read the report (profit factor, drawdown, number of trades) and avoid the mistakes that make backtests look better than reality.

7 min read. Updated 2026-12-03.

A backtest runs a bot on past prices to show how its rules would have traded. It cannot tell you what will happen next, but it is the quickest way to see how a bot behaves: how often it trades, how big its losing streaks are, and how deep its drawdowns go.

1. Open the Strategy Tester

In MetaTrader 5, open View, then Strategy Tester, or press Ctrl+R. Choose the single test mode for one Expert Advisor.

2. Choose the settings

  • Expert: the bot you want to test.
  • Symbol and timeframe: the market and timeframe the bot is designed for.
  • Date: a long period with different market conditions, ideally several years.
  • Modelling: Every tick based on real ticks is the most realistic where your broker provides the data. 1 minute OHLC is faster and fine for a first look. Open prices only can be misleading for bots that act inside a bar.
  • Deposit and leverage: what you would really use.
  • Delays: a small delay is more realistic than none.
  • Forward: set a forward period to keep the last part of the data unseen while you choose settings, then check that the results hold up on it.

3. Read the report

After the test, open the Backtest tab. These are the numbers that matter most:

  • Total net profit: the result after all trades. Never read it on its own.
  • Maximal drawdown (balance and equity): the largest fall from a peak. Equity drawdown includes losses on open trades, so it is the more honest figure.
  • Profit factor: gross profit divided by gross loss. Above 1 means the rules made more than they lost on this data.
  • Total trades: a result built on a handful of trades proves very little. More trades give more confidence.
  • Largest losing streak: imagine living through it with real money.

Then look at the graph. A balance line that rises smoothly while the equity line repeatedly dips far below it is a sign of trades held in large losses, which is typical of grid and martingale bots.

4. Mistakes that make backtests look too good

  • Over-optimising: trying thousands of setting combinations until one looks perfect on the past. It usually fails on new data. Use the forward period.
  • Unrealistic costs: test with your broker's real spread and commission.
  • Too short a period: one good year proves little. Include calm and volatile years.
  • Testing on the wrong market or timeframe for the bot.

A good backtest is a reason to test on demo, not a reason to go live. Run the bot on a demo account for several weeks and compare its trades with the backtest.

Go further