How to Backtest an Expert Advisor in MT5: A Step-by-Step Guide
Before you run an Expert Advisor on a live account, you want to know how it has performed historically. MetaTrader 5's Strategy Tester lets you run a backtest — a simulation of how the EA would have traded using historical price data. This guide walks through the process of running a backtest in MT5, step by step.
Opening the Strategy Tester
In MetaTrader 5, press Ctrl+R or go to View → Strategy Tester. The Strategy Tester panel opens at the bottom of the screen.
Step 1: Select your Expert Advisor
In the Strategy Tester, the first dropdown is for the EA. Click it and select the EA you want to test. The EA must already be installed — its file should be in MQL5/Experts/ in the MT5 data directory.
If your EA does not appear in the list, go to File → Open Data Folder → MQL5 → Experts, and confirm the .ex5 file is there. Restart MT5 if needed.
Step 2: Select the symbol
Choose the instrument the EA is designed for. If it is a Gold EA, select XAUUSD. If it is a EURUSD EA, select EURUSD. Some EAs can trade any instrument; for those, select the instrument you plan to trade.
Step 3: Choose the timeframe
Select the chart timeframe the EA uses. This should match the timeframe the EA was designed for — a daily timeframe EA should be tested on D1, an hourly EA on H1, and so on.
Step 4: Select the modelling method
The modelling method determines how accurately MT5 simulates price movement during the backtest:
- Every tick based on real ticks: The most accurate option. Uses actual tick data downloaded from the broker. Use this for scalping EAs where exact entry and exit prices matter.
- Every tick: Uses mathematical modelling to simulate ticks from 1-minute bar data. Good for most EAs.
- 1 minute OHLC: Uses only the open, high, low and close of each one-minute bar. Only use this for very long-period EAs.
For most purposes, "Every tick" is a reasonable balance of accuracy and speed.
Step 5: Set the date range
Select the start and end dates for your backtest. A longer backtest is more meaningful statistically and covers more market conditions.
Minimum recommended: 3 years. Preferred: 5–10 years, covering different market regimes (trending, ranging, high-volatility periods).
Step 6: Configure the deposit and currency
Set the deposit to the same size you plan to use in live trading. If you plan to trade a $5,000 account, backtest with $5,000. Using a $1,000,000 starting balance distorts the results.
Step 7: Set EA input parameters
Click the "Input parameters" tab in the Strategy Tester to access the EA's settings. Configure these the same way you would for live trading: lot size, stop loss and take profit, magic number, and any other parameters specific to the EA.
Step 8: Run the backtest
Click the "Start" button. The backtest begins running. For long date ranges with tick data, this can take several minutes.
Step 9: Read the results
When the backtest completes, review the Results and Graph tabs:
- Results tab: Shows each individual trade
- Graph tab: Shows the equity curve over time
- Report tab: Contains summary statistics including total profit, profit factor, maximum drawdown, win rate and trade count
Common backtest mistakes to avoid
- Using 90% modelling quality and treating it as reliable. Below 90% means significant portions used estimated data, which reduces reliability.
- Short test periods. A three-month backtest during a bull market tells you nothing about drawdowns or reversals.
- Ignoring spread. Run the backtest with the actual spread you pay your broker.
- Cherry-picking the best date range. Run the backtest across the full available history.
Backtest results do not guarantee future performance. Always follow a backtest with a forward test on a demo account before trading live.


