Home › Blog

How to Backtest an Expert Advisor in MetaTrader 5 Strategy Tester

By MR WOW EA Team · October 10, 2026 · 10 min read

Why Backtest an EA Before Live Trading?

Before you run any Expert Advisor on a live or demo account, backtesting is essential. When you backtest EA MT5, you replay historical market data to see how your EA's logic would have performed in the past. This does not predict future results, but it helps you understand the EA's behavior, spot potential issues, and adjust settings.

For example, if you're testing a gold scalping EA on XAUUSD, backtesting shows you how many trades it would have opened, how it handled spreads and slippage in different market conditions, and whether the risk settings make sense. Trading always carries risk, and backtesting is one way to prepare yourself for what might happen when real money is on the line.

Many retail traders skip this step and jump straight to live trading. That approach often leads to surprises—unexpected drawdowns, too many trades, or settings that don't fit their account size. A few hours of backtesting can save you from costly mistakes.

Step-by-Step: How to Backtest EA MT5 in Strategy Tester

Step 1: Install Your Expert Advisor

First, make sure your EA is properly installed in MT5. The EA file (with a .ex5 extension) should be in the MQL5/Experts folder inside your MT5 data directory. If you need help with installation, check the setup instructions or visit our contact page for support.

Once installed, restart MT5 so the platform recognizes the new EA. You should see it listed in the Navigator panel under "Expert Advisors."

Step 2: Open the Strategy Tester

In MT5, click View in the top menu, then select Strategy Tester. You can also press Ctrl+R on Windows or Cmd+R on Mac. The Strategy Tester panel will appear at the bottom of your screen.

This is where all backtesting happens. The interface has several tabs: Settings, Inputs, Optimization, and Results. For a basic backtest, you'll focus on the Settings and Inputs tabs.

Step 3: Choose Your Expert Advisor

In the Strategy Tester Settings tab, find the dropdown menu next to Expert Advisor. Click it and select the EA you want to test. For instance, if you're backtesting the Trend Stacker EA, select it from the list.

If your EA doesn't appear, double-check that the .ex5 file is in the correct folder and that you restarted MT5.

Step 4: Select the Symbol and Timeframe

Next, choose the currency pair or instrument. If you're testing an EA built for XAUUSD (gold), select XAUUSD from the Symbol dropdown. Make sure this symbol is available in your MT5 Market Watch. If it's not listed, right-click in Market Watch, choose "Show All," and find XAUUSD.

Then pick a Period (timeframe). Many EAs work on specific timeframes—M5 (5-minute), M15, H1 (1-hour), etc. If the EA documentation mentions a recommended timeframe, use that. For example, scalping EAs often run on M1 or M5, while swing EAs might use H1 or H4.

Step 5: Set the Backtest Date Range

You'll see fields for Date with a "From" and "To" option. This defines the historical period you want to test. A common approach is to test at least one full year of data to include different market conditions—trending, ranging, high volatility, low volatility.

For example, set "From" to 2023.01.01 and "To" to 2023.12.31. Some traders test several years, but be aware that longer backtests take more time, especially on lower timeframes.

Step 6: Choose the Execution Mode

MT5 offers several modes for backtesting:

For most EAs, especially those that trade frequently or use tight stop-losses (like the BUY STOP & SELL STOP EA), choose "Every tick based on real ticks" if you have the data, or "1 minute OHLC" as a compromise between speed and accuracy.

Step 7: Set Initial Deposit and Leverage

Under Deposit, enter the starting balance you want to simulate. Use a realistic number that matches your actual or planned account size. For example, if you plan to trade with $1,000, enter 1000.

Set Leverage to match your broker's offering. Common values are 1:100, 1:200, or 1:500. If you're unsure, check your broker's account details or leave it at a standard value like 1:100.

Step 8: Configure EA Inputs

Click the Inputs tab in the Strategy Tester. Here you'll see all the adjustable parameters for your EA—lot size, stop-loss, take-profit, magic number, risk percentage, and any custom settings.

Adjust these based on your risk tolerance and strategy. For example:

Refer to the EA's documentation for guidance on recommended settings. If none is provided, start conservatively and test different values later.

Step 9: Start the Backtest

Once everything is configured, click the Start button at the bottom of the Strategy Tester panel. MT5 will begin replaying historical data and executing trades according to your EA's logic.

You'll see a progress bar and a visual chart showing trades as they happen. Buys appear as blue arrows, sells as red. Wait until the backtest completes—this can take a few seconds to several minutes depending on the date range, timeframe, and execution mode.

Reading Your Backtest Results

When the backtest finishes, MT5 displays detailed results in several tabs:

Results Tab

This shows a list of every trade the EA opened during the backtest. You'll see entry time, exit time, symbol, lot size, profit or loss, and more. Scroll through to spot patterns—did the EA take many small losses in a row? Did it hold trades too long?

Graph Tab

The Graph tab shows your account balance and equity curve over time. A smooth upward slope is ideal. Sharp drops indicate drawdowns. If the equity curve looks like a rollercoaster or ends lower than it started, the settings or strategy need adjustment.

Report Tab

This is the most important summary. It includes key metrics:

Metric What It Means
Total Net Profit Total profit minus total loss over the backtest period (hypothetical).
Profit Factor Gross profit divided by gross loss. A value above 1.2 is generally considered decent, but no single number guarantees future success.
Total Trades Number of trades executed. Too few trades might mean the EA is too picky; too many might mean overtrading.
Maximal Drawdown The largest drop from a peak in account balance. This shows the worst losing streak. Compare it to your risk tolerance.
Win Rate (%) Percentage of winning trades. A 50% win rate can still be profitable if winners are larger than losers. Do not focus on this alone.

Remember, these are historical results based on past data. They do not predict future performance. Markets change, and past conditions may not repeat.

Common Backtest Settings to Adjust

After your first backtest, you might want to refine settings and run the test again. Here are common adjustments:

Change one variable at a time so you understand its impact. If you change five things at once, you won't know which made the difference.

Using Optimization to Find Better Settings

MT5 Strategy Tester also offers an Optimization mode. This runs multiple backtests automatically, testing different combinations of EA inputs to find the best-performing set.

To use it, go to the Settings tab and check the Optimization box. Then, in the Inputs tab, check the boxes next to parameters you want to optimize, and set a range of values (Start, Step, Stop).

For example, if you want to optimize lot size from 0.01 to 0.10 in steps of 0.01, set those values. Click Start, and MT5 will run many backtests, each with a different lot size, and rank results by a criterion you choose (like maximum balance or profit factor).

Optimization is powerful, but be careful. It's easy to over-optimize—finding settings that work perfectly on historical data but fail in live trading because they're too specific to past conditions. Always test optimized settings on fresh data (a different date range) before going live.

Forward Testing and Demo Accounts

Backtesting is just the first step. After you backtest EA MT5 and get satisfactory results, the next step is forward testing on a demo account. This means running the EA in real-time market conditions without risking real money.

Open a demo account, load your EA with the same settings you backtested, and let it run for a few weeks or months. Monitor how it performs compared to the backtest. If results are similar, the EA might be robust. If they differ significantly, the backtest may have been overfitted or market conditions have shifted.

Only after successful forward testing should you consider live trading—and even then, start with a small account or low lot sizes. Trading carries real risk of loss, and no amount of backtesting or forward testing eliminates that risk.

Tips for Accurate Backtesting

Example: Backtesting a Gold EA

Suppose you want to backtest the Trend Stacker EA on XAUUSD. Here's a quick checklist:

  1. Install Trend Stacker in MT5 and restart the platform.
  2. Open Strategy Tester (Ctrl+R).
  3. Select Trend Stacker from the EA dropdown.
  4. Choose XAUUSD as the symbol and M15 as the timeframe (or whatever the EA recommends).
  5. Set date range: January 1, 2023 to December 31, 2023.
  6. Choose "Every tick based on real ticks" for accuracy.
  7. Set deposit to 1000 USD, leverage 1:100.
  8. In Inputs, set lot size to 0.01, stop-loss to 50 points, take-profit to 100 points (example values).
  9. Click Start and wait for the backtest to complete.
  10. Review the Report tab: check total net profit, maximal drawdown, profit factor, and total trades.
  11. Look at the Graph tab to see the equity curve.
  12. If satisfied, move to forward testing on a demo account.

This process applies to any EA, whether you're testing a scalping bot or a longer-term strategy.

What Backtest Results Don't Tell You

Backtesting is useful, but it has limits. It assumes perfect execution, no server downtime, no broker requotes, and no emotional interference from the trader. In reality, live trading introduces variables that backtests can't simulate perfectly.

Also, historical data does not guarantee future results. An EA that performed well in 2023 might struggle in 2024 if market conditions change. Economic events, central bank policies, geopolitical shifts—all these can alter how markets behave.

Use backtesting as a tool for understanding and refining your EA, not as proof that it will make money. Combine it with demo testing, continuous monitoring, and sound risk management.

Getting Help with Backtesting

If you run into issues—EA not appearing, strange results, errors during the backtest—don't hesitate to reach out. Visit our contact page for setup help and troubleshooting. Our team can guide you through installation, configuration, and interpreting backtest results for MR WOW EA products.

Final Thoughts

Learning how to backtest EA MT5 properly is a skill every EA trader should develop. It helps you avoid costly mistakes, understand your EA's behavior, and set realistic expectations. Follow the steps above, take your time adjusting settings, and always remember that backtesting is just one part of a complete trading plan. Combine it with forward testing, risk management, and continuous learning to improve your trading over time.

Frequently Asked Questions

How long should I backtest an EA in MT5?

Test at least 6-12 months of historical data to cover different market conditions. Longer backtests (2-3 years) provide more insight, but they take more time. Always validate backtest results with forward testing on a demo account before live trading.

What is the most accurate execution mode for backtesting in MT5?

"Every tick based on real ticks" is the most accurate mode because it uses actual tick data. If real tick data is unavailable or the backtest is too slow, "1 minute OHLC" is a good compromise for most strategies.

Can I trust backtest results to predict future profits?

No. Backtests show how an EA would have performed on past data under ideal conditions, but they do not predict future results. Markets change, and past performance does not guarantee future success. Always forward test and manage risk carefully.

How do I fix "no data" errors when backtesting in MT5?

"No data" means MT5 doesn't have historical data for the symbol and timeframe you selected. Right-click the chart of that symbol, choose "Refresh," or go to Tools > History Center and download missing data. Make sure the symbol is active in Market Watch.

Should I optimize my EA settings before backtesting?

Start with default or recommended settings from the EA documentation, run a basic backtest, then use optimization if you want to explore better parameter combinations. Be cautious of over-optimization—settings that fit historical data perfectly may fail in live markets.

Risk warning: Trading forex and gold carries a high level of risk. Past performance does not guarantee future results. Test any EA on a demo account first. Read the full risk disclaimer.
Need help setting up an EA? Browse our MT5 Expert Advisors and indicators or contact our support team.

More articles