Why Backtesting Matters
Backtesting is your EA's first real test. It simulates how your strategy would have performed on historical data. But here's the problem: most traders backtest incorrectly and get results that don't translate to live trading.
A properly backtested EA should give you:
The harsh truth: An EA that shows 500% returns in backtesting might lose money in live trading if the test was flawed.
The 7 Critical Mistakes
Mistake 1: Using Low-Quality Data
Most traders use the default data from their broker, which has gaps, incorrect prices, and missing ticks. This is like testing a race car on a broken track.Solution: Use 99% modeling quality tick data from providers like Dukascopy or TrueFX. For MT5, download real tick data from your broker.
Mistake 2: Ignoring Spread Variations
Fixed spreads in backtests don't reflect reality. Spreads widen during news, Asian sessions, and low liquidity periods.Solution: Use variable spread simulation or add a spread buffer (e.g., if average spread is 1.2 pips, test with 1.8 pips).
Mistake 3: Not Accounting for Slippage
In live trading, you rarely get the exact price you requested. Slippage can be 0.5-3 pips on average, more during volatility.Solution: Add slippage simulation of at least 1 pip for major pairs, 2-3 pips for exotic pairs.
Data Quality
What Good Data Looks Like
How to Check Data Quality
``
In MT4/MT5 Strategy Tester:
1. Run a test
2. Check the "Report" tab
3. Look for "Modeling quality" percentage
4. Look for "Mismatched charts errors"
``Red flags:
Spread and Slippage
Realistic Spread Settings
| Pair | Average Spread | Test With | |------|---------------|-----------| | EURUSD | 0.8-1.2 pips | 1.5-2.0 pips | | GBPUSD | 1.0-1.5 pips | 2.0-2.5 pips | | USDJPY | 0.8-1.2 pips | 1.5-2.0 pips | | XAUUSD | 20-35 cents | 40-50 cents |
Slippage in Code
``mql4
// Add slippage to your OrderSend
int slippage = 30; // 3 pips for 5-digit broker
ticket = OrderSend(Symbol(), OP_BUY, lots, Ask, slippage, sl, tp);
``
Pro tip: Run the same backtest with different spread/slippage settings. If your profits disappear with slightly higher costs, your edge is too thin.
Walk-Forward Analysis
Walk-forward analysis is the gold standard for validating EA performance. It prevents curve-fitting by testing on data the optimizer never saw.
How It Works
What Good Results Look Like
If your EA only works on optimized periods, it's curve-fitted and will fail live.
Statistical Significance
How Many Trades Do You Need?
A backtest with 50 trades is statistically meaningless. Here's the minimum:
| Confidence Level | Minimum Trades | |-----------------|----------------| | Low confidence | 100 trades | | Medium confidence | 300 trades | | High confidence | 500+ trades |
Key Metrics to Evaluate
The Monte Carlo Test
Run 1,000 simulations with randomized trade order to see:
Use our Monte Carlo Calculator to test your strategy parameters.
Conclusion
Proper backtesting is hard work, but it separates professional EA developers from gamblers. Follow these principles:
Remember: A smaller, verified edge is worth more than a big, unverified one.
Need help validating your EA? Get a free strategy audit or use our profitability calculator to stress-test your parameters.