Backtest EA on MT4: Get Reliable Results (2026)
To backtest an EA on MT4 reliably: 1) Get quality M1 data from Dukascopy, 2) Import via History Center (F2), 3) Open Strategy Tester (Ctrl+R) and select "Every tick" model, 4) Set realistic spread and 2+ year date range, 5) Only trust results with 90%+ modeling quality. Below 90%, backtests are essentially unreliable.
I've run thousands of backtests on MT4 over the years, and most of what traders show me is worthless. They test with poor data, use the wrong settings, or misread the report, then wonder why a "profitable" backtest EA loses real money the moment it goes live. This guide walks through the exact steps for getting results that actually predict live performance, including the data-quality work most tutorials skip entirely.
This is the MT4 companion to our broader guide on backtesting a gold EA properly. If you trade XAUUSD specifically, pay close attention to the gold-specific sections further down; spread behavior, swap costs, and session volatility all test differently on gold than they do on a typical forex pair, and treating XAUUSD like EURUSD in the Strategy Tester is one of the fastest ways to get a misleading report.
In This Guide
Why Most MT4 Backtests Fail
Before you backtest an EA on MT4, it helps to know why the results so often mislead. Having helped plenty of traders set up Golden Viper EA, here are the pitfalls I run into again and again.
Problem 1: Default MT4 Data Is Terrible
The historical data MT4 ships with has some real problems, and they compromise every test built on top of it:
- Missing periods: gaps in the history force the tester to skip stretches or interpolate over them
- Price errors: spikes and bad ticks that can trigger trades that never really happened
- Limited history: often just a few months are available out of the box
- Low resolution: M1 data can be synthetically generated rather than pulled from real market activity
The "modeling quality" metric in MT4 exposes this problem right away. Here's what each level actually means for how much you can trust the results:
| Modeling Quality | Reliability | Action Required |
|---|---|---|
| 25-50% | Essentially random | Do not trust these results |
| 50-89% | Significant error margin | Improve your data quality |
| 90%+ | Reliable for evaluation | Results are meaningful |
| 99% | Professional grade | Requires tick data tools |
Problem 2: Unrealistic Spread Settings
MT4 backtests use a fixed spread, usually whatever the "current spread" happens to be the moment you start the test. In live trading, spreads widen during news events like FOMC announcements, thin-liquidity sessions, and volatile stretches. Test with a spread 20-30% above your broker's average so the backtest accounts for that.
Problem 3: Curve-Fitting
If an EA was optimized on a specific stretch of historical data, it'll perform beautifully on that data and struggle on anything new. The backtest is essentially memorizing the past instead of predicting the future, and it's the single most common reason a backtest looks amazing while live trading falls flat. Investopedia's explanation of overfitting is worth reading in full if the term is new to you, because the same statistical trap applies whether you're optimizing an EA or a trading indicator.
Our guide on detecting over-optimization in the MT4 Strategy Tester walks through the specific warning signs (an equity curve that's too smooth, an unusually high number of optimized inputs relative to the number of trades, parameters that only make sense for one narrow slice of history) so you can catch a curve-fitted EA before you buy it or before you ship your own settings to a live account.
Problem 4: Ignoring Slippage, Commission, and Swap Costs
Even with 99% modeling quality and a realistic spread, a default MT4 backtest still leaves money on the table if you don't account for the other costs of live execution. Slippage (the difference between the price an order was requested at and the price it actually filled at) tends to be zero or near-zero in a standard backtest, but it's very real on a volatile instrument like gold, especially around high-impact news. Commission on ECN/raw-spread accounts isn't modeled unless you enter it manually in the Strategy Tester's account settings, and swap (the overnight financing cost or credit for holding a position) is frequently left out entirely, which quietly inflates the backtested return of any EA that holds trades for more than a few hours. Our breakdown of what causes gold EA slippage and how to reduce it covers the mechanics in more depth, but the short version for backtesting purposes is: add a few extra points of spread as a slippage buffer, enter your broker's actual commission schedule, and don't ignore swap if the EA carries positions overnight.
Step 1: Get Quality Historical Data
Good backtests start with good data. As Investopedia's definition of backtesting puts it, the whole exercise is only as trustworthy as the historical data it's built on, which is exactly why data quality gets more attention in this guide than any single Strategy Tester setting. There are three main routes to get quality data, depending on your budget and how much effort you're willing to put in.
Option A: Download from Your Broker (Easiest)
- Open MT4 and go to Tools → History Center (or press F2)
- Find your symbol (e.g., XAUUSD) in the left panel
- Double-click each timeframe to download available data
- Click "Download" if the button appears
Limitation: many brokers only offer 1-2 years of history, and the quality swings a lot from one broker to the next.
Option B: Dukascopy Data (Best Free Option)
MetaQuotes built MT4 to work with imported data, and Dukascopy's historical data portal is one of the best sources of free, high-quality tick data out there:
- Visit the Dukascopy historical data page and navigate to the instrument list
- Select your instrument (XAUUSD is listed as "Gold")
- Choose a date range (5+ years is ideal for comprehensive testing)
- Download tick or M1 data in CSV format
- Convert the data to MT4-compatible format if needed
One caveat worth knowing up front: Dukascopy's own feed comes from Dukascopy's liquidity providers, so it won't match your broker's exact tick-by-tick prices. That's fine, and expected, for most purposes: the goal is realistic, gap-free market movement to generate ticks from, not a perfect replica of your specific broker's quotes. What matters far more than an exact price match is that the spread and slippage settings you apply on top of that data (covered in Step 3) reflect your actual broker.
Option C: Tick Data Suite (Best Paid)
- Auto-downloads high-quality Dukascopy data
- Converts to MT4 format automatically
- Supports variable spread modeling for realistic conditions
- Achieves 99.9% modeling quality consistently
Step 2: Import Data into MT4
Once you have your data files, import them into MT4's History Center:
- Open Tools → History Center (F2)
- Navigate to your symbol and select the M1 timeframe
- Click the "Import" button
- Select your CSV file and verify the format:
Date,Time,Open,High,Low,Close,Volume - Click OK and wait for the import to complete
- Close History Center
After importing M1 data: Use the PeriodConverter script to generate higher timeframes (M5, M15, H1, H4, etc.) from your M1 data. Attach the script to an M1 chart and set the multiplier (e.g., 5 for M5, 60 for H1). This ensures all timeframes share the same high-quality source data.
Step 3: Configure the MT4 Strategy Tester
Open the Strategy Tester by going to View → Strategy Tester (or pressing Ctrl+R). Then configure each setting carefully. MQL5's own documentation on the Strategy Tester covers every field in the interface if you want the full technical reference; the checklist below is the practical subset that actually changes your results.
Essential Settings Checklist
- Expert Advisor: Select your EA from the dropdown
- Symbol: Choose the correct trading instrument (e.g., XAUUSD)
- Model: Always use "Every tick" for final validation
- Spread: Set realistic spread (30-50 points for gold standard accounts)
- Date range: Enable "Use date" and select 2+ years
- Initial deposit: Match your planned live trading capital
Backtest Model Comparison
| Model | Accuracy | Speed | When to Use |
|---|---|---|---|
| Every tick | Highest | Slowest | Always for final validation |
| Control points | Medium | Medium | Quick rough screening only |
| Open prices only | Low | Fastest | EAs that only trade on bar open |
Gold-Specific Spread Settings
- ECN/Raw accounts: 15-25 points typical spread
- Standard accounts: 25-40 points typical spread
- During news events: Can spike to 50-100+ points
Critical: an EA that's profitable at a 15-point spread can lose money at 40 points once conditions get volatile. Test with a spread 20-30% above your broker's stated average, and you'll have a realistic safety margin for live trading, where broker's execution quality matters more than most traders expect.
Step 4: Run the Backtest
Before clicking Start, run through this pre-test checklist to avoid wasting time on unreliable tests:
- Quality data imported and verified in History Center
- Model set to "Every tick"
- Realistic spread configured (higher than broker average)
- Date range covers 2+ years of market data
- EA parameters configured correctly in the Inputs tab
- Initial deposit set to a realistic trading amount
Click Start and keep an eye on the progress bar. Watch the modeling quality indicator at the bottom; if it drops below 90%, stop the test, fix your data, and restart. Depending on the date range and how dense the data is, the run can take anywhere from a few minutes to several hours.
Step 5: Interpret the Backtest Report
Once it's done, right-click the results and choose "Open Report" to see the full breakdown. These are the metrics I check on every backtest, along with what a healthy range looks like:
| Metric | Healthy Range | What It Tells You |
|---|---|---|
| Modeling Quality | 90%+ | Below 90% means results are unreliable |
| Profit Factor | 1.3 - 2.5 | Below 1.3 is marginal; above 2.5 may be overfitted |
| Max Drawdown | Under 25% | Expect 1.5-2x this value in live trading |
| Total Trades | 100+ | Under 30 trades is statistically insignificant |
| Win Rate | Context-dependent | Evaluate alongside profit factor and risk-reward |
The max drawdown figure deserves extra attention because it's the number most traders under-plan for. A backtested max drawdown of 15% has a real chance of becoming 25-30% in live conditions once you factor in slower demo/live execution differences, real slippage, and the fact that historical data simply hasn't seen every possible market scenario yet. If you're unsure what a reasonable drawdown ceiling looks like for your own risk tolerance and account size, our max drawdown guide walks through how to set a personal drawdown limit before you ever click Start on a live account.
Red Flags to Watch For
- Perfect equity curve: real trading always has dips, so a perfectly smooth curve is a sign of overfitting
- Profit factor above 3.0: suspiciously high, usually a sign the EA was curve-fitted to that test period
- Very few trades: under 30 trades and the results don't mean much statistically
- One huge winning trade: if a single trade accounts for 80% of the profit, the strategy isn't one you can rely on
Backtesting XAUUSD Specifically
Gold behaves differently from a currency pair, and a backtest that doesn't account for those differences will overstate how smooth live trading feels. A few things worth checking specifically for XAUUSD before you trust a report:
Spread Widens More Dramatically Around News
Gold reacts hard to US CPI, NFP, and Fed rate decisions, and spreads on XAUUSD can widen well beyond the 50-100 point range mentioned earlier during the first minute or two after a major release. If your EA trades through news windows rather than pausing, a fixed backtest spread badly understates the real cost of those fills. Our guide to gold's volatility patterns breaks down which sessions and news events move XAUUSD the most, which is useful context when you're deciding how much extra spread buffer to build into your test.
Session Overlap Changes Liquidity, and Therefore Fill Quality
XAUUSD trades most liquidly during the London/New York overlap. Backtests don't model liquidity thinning during the Asian session or around rollover the way live execution does, so an EA that looks fine across a full 24-hour backtest average can still take worse fills than expected during the thinner hours. This is one more reason total trades and win rate alone don't tell the full story: two EAs with identical backtest stats can behave very differently once real liquidity and real spread timing enter the picture.
Contract Specs and Symbol Naming Vary by Broker
XAUUSD isn't a centrally traded futures contract the way CME gold futures are; retail CFD brokers set their own contract size, minimum lot, and margin requirements for the symbol, and some append a suffix (XAUUSD.m, GOLD, XAUUSDm) that can break an EA's symbol detection if you switch brokers between backtest and live. Always confirm the exact symbol name and contract specification in your broker's Market Watch before you run a backtest, and re-confirm it again before going live, especially if you're testing with Dukascopy data pulled under a generic "Gold" label. For a wider view of how the spot gold market itself is priced and tracked outside of any single broker's feed, the World Gold Council's market data hub is a useful independent reference point.
MT4 vs MT5 Strategy Tester: What Changes
If you're deciding which platform to backtest on, or you're migrating an EA from one to the other, it helps to know that MT5's Strategy Tester isn't just a reskinned version of MT4's. MT5 tests multiple symbols and timeframes in a single pass, supports real tick data natively without needing a third-party tool to reach 99% modeling quality, and can run optimizations distributed across a local network or the MQL5 Cloud. MT4's tester is simpler and single-threaded for the actual test run (though optimization can still use multiple cores), which makes it slower for large date ranges but arguably easier to reason about when you're just trying to validate one EA on one symbol. Neither platform is "wrong" for backtesting gold specifically; the practical answer usually comes down to which platform your broker and your EA support. Golden Viper EA covers both MT4 and MT5, so you can backtest on whichever platform you already use without losing functionality. If you're weighing the two platforms more broadly, our comparison of MT4 vs MT5 for XAUUSD and our companion guide to backtesting an EA on MT5 cover the platform-specific steps in full.
Validating Your Results
A profitable backtest is necessary but not sufficient proof that an EA works. You need additional validation before risking real capital.
Out-of-Sample Testing
- Use 70% of your data for the backtest (in-sample period)
- Reserve the remaining 30% as hidden data (out-of-sample period)
- Run the backtest on the in-sample data first
- Without changing any settings, test on the out-of-sample period
- Results should land close, within 20-30% of the in-sample performance
If the out-of-sample results are dramatically worse, the EA is likely over-optimized for historical data and will struggle with live markets. Our deeper walkthrough on backtesting a XAUUSD EA without overfitting goes further into how to structure the in-sample/out-of-sample split specifically for gold's volatility patterns.
Walk-Forward Analysis and Monte Carlo Simulation
Out-of-sample testing is a good baseline, but two more advanced checks are worth knowing about even if you don't run them on every EA. Walk-forward analysis repeats the in-sample/out-of-sample split multiple times across rolling windows (optimize on months 1-6, test on month 7; optimize on months 2-7, test on month 8; and so on) so you get many small out-of-sample verdicts instead of one. It's more work to set up, but it's much harder to accidentally curve-fit your way past it than a single train/test split.
Monte Carlo simulation, borrowed from broader quantitative finance, takes your backtest's actual trade results and randomizes the order (or resamples them with replacement) hundreds or thousands of times to build a distribution of possible equity curves. Instead of one drawdown number, you get a range: what's the worst-case drawdown in the 95th percentile of simulated outcomes, not just the one sequence your historical data happened to produce. Some third-party tools (including a few strategy tester add-ons) automate this on top of MT4's raw trade export. It's not a step every retail trader needs to take for every EA, but it's the closest thing to an honest answer to "how bad could this realistically get" that a backtest alone can't give you.
For a grounded look at how backtested numbers tend to compare with what traders actually experience once real money and real execution enter the picture, see our piece on backtest results vs. real trading.
Forward Testing on Demo
The ultimate validation is running the EA on a demo account against live market data for at least 2-4 weeks. This tests real-time execution, spread behavior, and market conditions no backtest can fully simulate. I always recommend this step before going live; our guide on lot sizing for $1,000 accounts covers the risk management side of that transition.
Pro tip from our team: Golden Viper EA's track record is verified on Myfxbook with live trading, not backtests. We still encourage every user to backtest it themselves before going live, but live-verified results remain the gold standard. Here's how to run an EA on demo first.
Frequently Asked Questions About Backtesting EA on MT4
Why is my MT4 backtest modeling quality only 25%?
Low modeling quality (25-50%) means MT4 lacks complete M1 data to generate ticks for "Every tick" mode. Download quality M1 data from Dukascopy or your broker, import it via History Center (F2), then run PeriodConverter to generate higher timeframes. This typically raises quality to 90%+.
How long should an EA backtest period be?
Minimum 1 year, recommended 2-3 years, ideal 5+ years. Longer periods cover more market conditions including trending, ranging, and volatile phases. Data older than 10 years may be less relevant as market dynamics evolve.
What modeling quality is acceptable for EA backtesting?
90%+ modeling quality is the minimum for reliable results. Below 90%, backtests carry significant error margins and should not be trusted for live trading decisions. Use Tick Data Suite or quality Dukascopy data to reach 99% modeling quality.
Can I trust an EA seller's backtest results?
Be cautious. Anyone can create profitable backtests through curve-fitting or cherry-picking date ranges. Only trust verified live trading results on Myfxbook, backtests you run yourself on your own data, and forward testing on a demo account for at least 2-4 weeks.
What is the best backtest model to use in MT4?
Always use "Every tick" model for final validation of any EA. It provides the most accurate simulation by generating tick-level price movements from M1 data. "Control points" and "Open prices only" are faster but far less accurate and should only be used for rough screening.
Do I need to backtest an EA myself if the vendor already shows live results?
It's still worth doing. Verified live results (like a Myfxbook-linked track record) are more trustworthy than any backtest, since they can't be curve-fitted after the fact. But running your own backtest lets you see how the EA behaves under your specific broker's spread and your own risk settings, and it builds your understanding of the EA's behavior before you commit real capital. Treat backtesting and verified live results as complementary, not interchangeable.
What's the difference between backtesting and forward testing?
Backtesting runs an EA against historical price data to see how it would have performed in the past. Forward testing (also called paper trading or demo testing) runs the EA in real time on a demo account against live market data, without any risk to real capital. Backtesting is faster and covers more history; forward testing catches execution issues, requotes, and data-feed quirks that a backtest can't simulate. Reliable validation uses both, in that order.
Do slippage and commission actually change a backtest's outcome?
Yes, more than most traders expect. MT4's default backtest models zero slippage and no commission unless you configure them manually in the Strategy Tester's account settings. On a volatile instrument like gold, or on an EA that trades frequently, ignoring these costs can turn a marginally profitable strategy into an unprofitable one once it goes live. Always enter your broker's actual commission schedule and add a slippage buffer before trusting a backtest's bottom-line numbers.
Should I backtest a gold EA on MT4 or MT5?
Whichever platform you actually plan to trade live on. MT5's Strategy Tester supports native tick-level modeling and multi-symbol testing without third-party tools, which can make reaching 99% modeling quality faster. MT4's tester is simpler and still fully capable of reliable "Every tick" testing once you've imported quality M1 data. Golden Viper EA covers both MT4 and MT5, so the choice comes down to platform preference rather than any backtesting limitation.
How do I know if an EA's backtest was curve-fitted to look good?
Watch for a suspiciously smooth equity curve with almost no drawdown, a profit factor above 3.0, very few total trades, or performance that drops sharply outside the original test window. Ask to see (or run yourself) an out-of-sample test on data the EA wasn't optimized against; a large gap between in-sample and out-of-sample performance is the clearest sign of curve-fitting.
Let Golden Viper EA trade gold for you
Automated XAUUSD trading for MT4 & MT5, verified live on Myfxbook. One-time $199, lifetime access.
Get Lifetime Access — $199