How to Backtest an EA on MT4 (Step-by-Step)

Quick Answer

To backtest an EA on MT4: Open Strategy Tester (Ctrl+R), select your EA and symbol, choose "Every Tick" modeling, set your date range, and click Start. For reliable results, first download quality historical data through Tools > History Center or use third-party tick data. Aim for 90%+ modeling quality and always validate backtests with forward testing on a demo account.

Backtesting is the most important step before risking real money with any Expert Advisor. A proper backtest tells you how an EA would have performed historically -- but only if you do it correctly. I have seen traders lose thousands because they trusted poorly configured backtests with 25% modeling quality. In this tutorial, I will walk you through every step of backtesting an EA on MT4, from downloading quality data to interpreting results accurately.

Prerequisites

Before you start backtesting, make sure you have the following ready:

  • MetaTrader 4 installed and connected to your broker account
  • The EA file (.ex4) placed in MT4's Experts folder
  • Sufficient disk space for historical data (at least 500MB free)
  • The correct symbol added to Market Watch (e.g., XAUUSD for gold)

If you have not installed your EA yet, follow our guide on understanding EA settings first.

Step 1: Download Quality Historical Data

The quality of your backtest depends entirely on the quality of your historical data. MT4's default data is often incomplete, resulting in low modeling quality and unreliable results.

Method A: Download from History Center (Basic)

  • Go to Tools > History Center (or press F2)
  • Find your symbol (e.g., XAUUSD) in the list
  • Select the M1 (1-minute) timeframe
  • Click Download
  • Wait for the data to finish downloading

This method provides basic data from MetaQuotes' servers. Modeling quality typically reaches 90% with this data, which is acceptable for initial screening.

Method B: Use Third-Party Tick Data (Advanced)

For the most accurate backtests, use tick data from providers like Dukascopy. Third-party tick data achieves 99% modeling quality by including every price tick rather than interpolating from 1-minute bars.

Data SourceModeling QualityAccuracyBest For
MT4 Default (M1)25-50%LowQuick screening only
History Center Download85-90%GoodGeneral backtesting
Tick Data (Dukascopy)99%ExcellentFinal validation before live trading

Gold-specific note: XAUUSD historical data varies significantly between brokers due to different spread models and price feeds. Always backtest with data from the same broker you plan to trade live on, or use tick data with variable spread simulation.

Step 2: Configure the Strategy Tester

Open the Strategy Tester by pressing Ctrl+R or going to View > Strategy Tester. Configure these settings:

  • Expert Advisor: Select your EA from the dropdown
  • Symbol: Choose the trading instrument (e.g., XAUUSD)
  • Model: Select "Every Tick" for the most accurate simulation
  • Period: Match the timeframe your EA is designed for (e.g., H4 for Golden Viper EA)
  • Spread: Set to "Current" or manually enter your broker's typical spread
  • Date range: Check "Use date" and set at least 2-3 years of history

Strategy Tester Models Explained

ModelSpeedAccuracyWhen to Use
Every TickSlowestHighestFinal validation, scalping EAs
Control PointsMediumMediumQuick optimization runs
Open Prices OnlyFastestLowestBar-open-only strategies

Setting EA Parameters

Click the Expert Properties button to configure your EA's input parameters. Key settings to adjust:

  • Initial deposit: Match your planned live account size
  • Lot size / Risk percentage: Use the same settings you plan to trade live
  • Stop loss and take profit: Keep default EA values for initial testing
Skip the guesswork.Golden Viper EA -- pre-optimized settings, +135% monthly verified.
Try Free →

Step 3: Run the Backtest

Click the Start button. The backtest duration depends on your data volume, timeframe, and model selection:

  • Every Tick + 3 years + XAUUSD: 10-60 minutes typically
  • Control Points + 3 years: 2-10 minutes
  • Open Prices + 3 years: Under 1 minute

You can watch the visual progress by checking "Visual mode" in the tester settings. This slows down the test significantly but lets you see how the EA trades on each bar -- useful for understanding its logic.

Step 4: Interpret Backtest Results

After the backtest completes, review the results across three tabs:

Results Tab

Shows every individual trade with entry/exit prices, lot sizes, profit/loss, and timestamps. Look for:

  • Consistent lot sizing (avoid EAs that dramatically increase lots after losses)
  • Realistic hold times matching the EA's stated strategy
  • Stop losses being hit rather than only profitable exits (indicates the EA uses stops properly)

Report Tab -- Key Metrics

MetricWhat It Tells YouHealthy Range
Modeling QualityData reliability90%+ (reject below 90%)
Total Net ProfitOverall profitabilityPositive (obviously)
Profit FactorGross profit / gross loss ratioAbove 1.5 (ideally 2.0+)
Max DrawdownLargest peak-to-trough declineUnder 30% of initial deposit
Win RatePercentage of profitable tradesVaries by strategy (50-85%)
Expected PayoffAverage profit per tradePositive and sustainable
Total TradesSample size200+ for statistical significance

Graph Tab

The equity curve should show steady upward growth with manageable pullbacks. Warning signs include: flat periods followed by sudden spikes (possible grid/martingale), perfectly smooth curves (too good to be true), or large sudden drops (no stop loss protection).

Common Backtesting Mistakes to Avoid

  • Low modeling quality: Never trust results below 90% modeling quality. The data is too unreliable to draw conclusions.
  • Fixed spread assumption: Gold spreads vary from 10 points during London to 50+ points during Asian session. Set realistic variable spreads.
  • Over-optimization: Tweaking parameters until the backtest looks perfect creates curve-fitted strategies that fail live.
  • Too short a test period: Testing only 3 months misses different market regimes. Test at least 2-3 years.
  • Ignoring drawdown: A 200% return means nothing if the maximum drawdown was 80%. Focus on risk-adjusted returns.
  • Skipping forward testing: Always validate backtests with real-time demo testing before going live.

Critical reminder: Backtests show what would have happened, not what will happen. Markets change, and past performance never guarantees future results. Always follow backtesting with 2-4 weeks of forward testing. See our risk management guide for capital protection strategies.

Step 5: Forward Testing (Validation)

Forward testing bridges the gap between backtest results and live trading. After a promising backtest:

  • Week 1-2: Run the EA on a demo account with the same broker and settings
  • Week 3-4: If demo results match backtest expectations (+/- 20%), start a small live account
  • Month 2-3: Scale up lot sizes gradually as live results confirm the backtest

Expect 10-30% performance difference between backtests and live trading due to variable spreads, slippage, and real execution conditions. If the difference exceeds 40%, the EA may be curve-fitted to historical data. For guidance on proper position sizing during forward testing, see our position sizing calculator guide.

Frequently Asked Questions About EA Backtesting

How do I backtest an EA on MT4?

Open Strategy Tester (Ctrl+R), select your EA, choose the symbol and timeframe, set "Every Tick" modeling, define the date range, and click Start. First download quality historical data through Tools > History Center for reliable results.

What modeling quality should I aim for?

Aim for 90% or higher. "Every Tick" mode with quality data achieves 90-99%. Results below 90% are unreliable. Third-party tick data from Dukascopy can reach 99% modeling quality.

Why do my backtest results differ from live trading?

Differences arise from variable spreads (vs fixed in backtests), execution slippage, requotes, and broker-specific pricing. Expect 10-30% performance difference. Always validate with demo forward testing.

How far back should I backtest an EA?

At least 2-3 years to cover trending, ranging, and volatile conditions. For gold EAs, test through at least one Fed rate cycle. Too short a period risks curve fitting.

Can I trust MT4 backtest results for gold EAs?

MT4 backtests provide directional guidance but are not exact predictions. Gold backtests are less reliable than forex due to wider variable spreads. Always follow with 2-4 weeks of forward testing on demo or small live accounts.

Myfxbook Verified

Skip Backtesting -- See Live Results

+135%Monthly Returns
81%Win Rate
24/5Automated
Starting at $99/month
Start 7-Day Free Trial →
✓ No credit card required✓ Full feature access✓ MT4 & MT5 compatible
GV

Golden Viper EA Team

We extensively backtest and forward test Golden Viper EA across multiple years of XAUUSD data. Our live Myfxbook results confirm what backtests predicted -- consistent, verified performance.

Myfxbook VerifiedLive Trading Since 202481% Win Rate