Backtesting Your EA Properly
Most backtests lie. Learn to create reliable tests that predict real-world performance instead of just confirming your hopes.
5-Step Backtesting Process
1Get Quality Historical Data
- Use tick data or M1 data for accurate results (avoid H1+ for scalpers)
- Ensure data covers multiple market conditions (trending, ranging, volatile)
- Minimum 2-3 years of data, ideally 5+ years
- Verify data has no gaps or missing periods
- Match data timezone to your broker's server time
2Configure Realistic Settings
- Set spread to typical live values (not zero spread)
- Enable variable spread if your broker has it
- Set commission correctly (per lot or per trade)
- Use 'Every tick based on real ticks' mode in MT5
- Set starting balance matching your intended live capital
3Run Multi-Period Tests
- Test across 3+ different time periods separately
- Include 2008, 2020, 2022 for crisis behavior
- Test recent 6 months separately for current relevance
- Run walk-forward analysis if possible
- Compare results across different currency pairs
4Analyze Beyond Profit
- Calculate Sharpe ratio (aim for >1.0)
- Check max drawdown duration (not just depth)
- Review monthly return consistency
- Examine losing streak statistics
- Verify trade distribution across time periods
5Validate with Out-of-Sample
- Reserve 20-30% of data for out-of-sample testing
- Never optimize on out-of-sample data
- Compare in-sample vs out-of-sample metrics
- If OOS is >30% worse, strategy may be overfit
- Repeat with different OOS periods
Key Metrics to Evaluate
| Metric | Good | Warning | Description |
|---|---|---|---|
| Net Profit | >0 | Negative | Total profit after all costs |
| Profit Factor | >1.5 | <1.2 | Gross profit / Gross loss |
| Max Drawdown | <20% | >40% | Largest peak-to-trough decline |
| Win Rate | 40-70% | <30% or >85% | Percentage of winning trades |
| Sharpe Ratio | >1.0 | <0.5 | Risk-adjusted returns |
| Recovery Factor | >3 | <1 | Net profit / Max drawdown |
| Trade Count | >100 | <30 | Statistical significance |
| Avg Trade | >3x spread | <spread | Average profit per trade |
Backtest Validation Checklist
Before trusting your backtest results, verify all critical items. Missing any critical item means your results are unreliable.
Common Backtesting Mistakes
Optimizing until it looks good
Why it matters: With enough parameter combinations, any strategy can look profitable on historical data.
Fix: Limit optimization iterations. Use walk-forward analysis. Always test out-of-sample.
Ignoring slippage and execution
Why it matters: Backtests assume perfect fills. Reality includes slippage, requotes, and partial fills.
Fix: Add 0.5-1 pip slippage to tests. Reduce expected performance by 20-30%.
Testing only on favorable periods
Why it matters: Every period has a strategy that works. Survivorship bias creates false confidence.
Fix: Include market crashes, low volatility periods, and ranging markets in your tests.
Using too few trades for conclusions
Why it matters: 30 trades could be pure luck. You need statistical significance.
Fix: Minimum 100 trades, ideally 200+. Be skeptical of short-term results.
Not accounting for changing market conditions
Why it matters: Markets evolve. 2015 EURUSD behaves differently than 2023 EURUSD.
Fix: Weight recent data more heavily. Plan for strategy degradation over time.
Templates & Resources
Realistic Test Settings
Pre-configured MT5 settings with proper spread/commission.
Backtest Report Template
Spreadsheet for tracking and comparing backtest results.
Build a Bot Worth Testing
Create your trading strategy and put it through rigorous validation.
Start Building