On this page
Back to tutorials

MT5 Strategy Tester Guide (2026) | Backtest, Optimize, Forward Test EA

Learn EA backtesting in MT5 Strategy Tester: real tick modes, parameter optimization, forward testing, and how to read drawdown and expectancy before live trading.

๐Ÿ“– 29 min read

๐Ÿ“ 5,800 words

๐Ÿท๏ธ MQL5 & Expert Advisors

Share this article:

Want to build a no-code strategy right now?

Create your free account in seconds and start building immediately.


Backtest Your EA in MetaTrader 5 โ€” Strategy Tester Guide

Before risking real money, you must backtest your Expert Advisor on historical data. The MetaTrader 5 Strategy Tester lets you run your EA through years of price history in minutes โ€” evaluating profit, drawdown, and trade count before going live. According to the official MT5 documentation, the tester uses accumulated quotes and performs virtual transactions according to your algorithm. This guide walks you through opening the tester, configuring settings, running a backtest, and reading results โ€” step by step.


Why Backtest First

  • Find bugs โ€” Logic errors, invalid stops, or margin issues surface in the tester before they cost real money.
  • Evaluate performance โ€” Profit factor, drawdown, and trade count tell you if the strategy is worth deploying.
  • Avoid overfitting โ€” Use forward testing to validate that parameters work on unseen data, not just the optimization period.

The Strategy Tester is multi-threaded and can use MQL5 Cloud Network for faster optimization. Per MetaTrader 5 Help: "The entire operation of the Strategy Tester is based on historical quotes. During testing, the Expert Advisor goes through the accumulated quotes and performs virtual transactions according to its algorithm."


Step 1: Open Strategy Tester

  1. In MetaTrader 5, go to View โ†’ Strategy Tester (or press Ctrl+R).
  2. The Strategy Tester panel opens at the bottom of the screen.

MetaTrader 5 Strategy Tester panel โ€” โ‘  Strategy Tester tabs โ‘ก Test type icons (Single, Visualize, Genetic) โ‘ข Previous test results list
MetaTrader 5 Strategy Tester panel โ€” โ‘  Strategy Tester tabs โ‘ก Test type icons (Single, Visualize, Genetic) โ‘ข Previous test results list

Source: MetaTrader 5 Strategy Tester โ€” official documentation.


Step 2: Select EA and Symbol

Select Expert Advisor:

  • In the Navigator (Ctrl+N), expand Expert Advisors.
  • Right-click your EA โ†’ Test โ€” it will be selected in the Strategy Tester.
  • Or choose it from the Expert Advisor dropdown in the tester.

Select Symbol:

  • Choose the symbol (e.g. EURUSD, XAUUSD) from the Symbol dropdown.
  • The symbol must be in Market Watch โ€” add it via View โ†’ Symbols (Ctrl+U) if needed.

Select Timeframe:

  • Choose the chart period (M15, H1, H4, etc.). This affects Symbol() and Period() in your EA.

MT5 Strategy Tester settings โ€” Expert Advisor selection in Navigator, Symbol (EURUSD), Timeframe (H1), and EA parameters on chart
MT5 Strategy Tester settings โ€” Expert Advisor selection in Navigator, Symbol (EURUSD), Timeframe (H1), and EA parameters on chart


Step 3: Date and Forward

Date:

  • Set the start and end dates for testing. Use at least 12 months for meaningful results.
  • The tester automatically downloads additional data before the start (to form at least 100 bars) โ€” per MT5 Help.

Forward:

  • The Forward option splits the period to avoid overfitting:

    • 1/2 โ€” First half for backtest, second half for forward validation.
    • 1/3 โ€” One third for forward.
    • 1/4 โ€” One quarter for forward.
    • No โ€” No forward testing; use full period for backtest.
  • The first part is used for optimization/backtest; the second part validates the results. If the EA performs well on both, parameters are less likely to be overfitted.


Step 4: Tick Generation Mode

Choose how the tester simulates price movement:

ModeAccuracySpeedUse
Every tick based on real ticksHighestSlowMost realistic; uses real ticks from broker
Every tickHighSlowestSimulated ticks; best when real ticks unavailable
1 minute OHLCGoodMedium4 prices per minute bar; good balance
Open prices onlyLowFastestOnly bar open; quick rough check
Math calculationsN/AFastNo market data; only OnInit, OnTester, OnDeinit

Per MetaTrader 5: "Every tick" is used to ensure the best testing accuracy. "1 minute OHLC" is introduced for traders who want to test quickly but accurately. "Open prices only" is for very quick and rough estimation.


Step 5: Deposit and Leverage

  • Deposit: Set the initial deposit (e.g. 10000). Default currency is the account deposit currency.
  • Leverage: Select leverage (e.g. 1:100). This affects margin and position sizing.

Step 6: Run and Read Results

  1. Click Start on the Settings tab.
  2. Progress is shown in the left panel.
  3. When finished, check the Result and Graph tabs.

Result tab:

  • Profit โ€” Total profit/loss.
  • Total trades โ€” Number of closed positions.
  • Profit factor โ€” Gross profit / Gross loss.
  • Expected payoff โ€” Average profit per trade.
  • Drawdown โ€” Maximum equity decline.
  • Risk factor โ€” Risk metric.

Graph tab:

  • Balance curve (blue) โ€” Account balance over time.
  • Equity curve (green) โ€” Balance + floating P/L.
  • Deposit load โ€” Margin/equity.

MT5 Strategy Tester Backtest tab โ€” Total Net Profit, Profit Factor, Drawdown, Total Trades, and entry distribution charts
MT5 Strategy Tester Backtest tab โ€” Total Net Profit, Profit Factor, Drawdown, Total Trades, and entry distribution charts

MT5 Strategy Tester Graph tab โ€” Balance (blue) and Equity (green) curves over time for EA backtest results
MT5 Strategy Tester Graph tab โ€” Balance (blue) and Equity (green) curves over time for EA backtest results


Optimization

To find the best input parameters:

  1. Click the Optimization checkbox (or select Optimization mode).
  2. For each input you want to optimize, set Start, Step, and Stop.
  3. Choose Optimization criterion (e.g. Balance max, Profit factor max).
  4. Click Start โ€” the tester runs multiple passes with different parameter combinations.
  5. Use Genetic algorithm to speed up optimization โ€” it skips many combinations.

Results are shown in the Optimization tab. You can sort by criterion and apply the best set to your EA.


Visual Testing

To watch your EA trade bar-by-bar:

  1. Enable Visualization in the tester settings.
  2. Click Start โ€” a new window opens with a chart.
  3. Use the toolbar to pause, speed up, or slow down.
  4. Trades appear as icons on the chart; the Journal shows EA messages.

Note: Visual mode works only with local agents. Optimization must be disabled.

MetaTrader 5 Strategy Tester Visual mode โ€” candlestick chart with EA trade signals, Market Watch, and Navigator
MetaTrader 5 Strategy Tester Visual mode โ€” candlestick chart with EA trade signals, Market Watch, and Navigator


Troubleshooting

SymptomCauseFix
EA not in dropdownNot compiled or not in MQL5/ExpertsCompile in MetaEditor (F7); save to Experts folder
No trades in backtestSymbol not in Market Watch, wrong logicAdd symbol; check Journal for errors
"Not enough money"Lot too large for depositReduce lot size or increase deposit
Slow backtestEvery tick mode, long periodUse 1 minute OHLC for faster testing
Optimization very slowMany parameter combinationsUse genetic algorithm; reduce step range

Next Steps

After a successful backtest, deploy to Demo first before going live. For more on EA development, see Build Your First EA and EA Risk Management.

Bonus Tip: Want to build and backtest your EA without writing code? Try AlfaTactix Strategy Builder free โ€” design strategies visually, export MQL5, and run in the Strategy Tester in minutes.

Build your no-code trading strategy now โ€” free

Create your account and start building a complete no-code strategy right now. Add indicators, filters, and risk rules, then export MQL5 in minutes.

Frequently Asked Questions

"Every tick based on real ticks" gives the most realistic conditions. "1 minute OHLC" is a good balance of speed and accuracy. "Open prices only" is fastest but least accurate โ€” use only for quick checks.

Forward testing splits your date range: the first part is used for optimization/backtest, the second part validates the results. This helps avoid overfitting โ€” parameters that work on past data may fail on unseen data.

Check: symbol in Market Watch, sufficient history downloaded, AutoTrading enabled, EA allowed for live trading in Properties. Check the Journal tab for error messages.

Result tab shows detailed statistics (profit, trades, drawdown, risk factor). Graph tab shows the balance/equity curve over time.

Yes. The Strategy Tester is multi-currency. Enable all required symbols in Market Watch before testing. The tester downloads history for symbols used by the EA.

Build your no-code strategy now โ€” free

Create Free Account