📊 Why Backtest?
Backtesting is testing your trading strategy on historical data to see how it would have performed. It's the difference between gambling and professional trading.
What is Backtesting?
Backtesting is the process of testing a trading strategy on historical price data to evaluate its performance before risking real money.
Why Backtest?
- Test Strategies: See if your strategy actually works
- Optimize Parameters: Find best settings for indicators
- Build Confidence: Know your strategy is profitable
- Avoid Losses: Don't risk money on untested strategies
- Professional Approach: All professional traders backtest
The Reality
Without Backtesting:
- You're gambling
- You don't know if your strategy works
- You'll lose money testing on live account
With Backtesting:
- You know your strategy's win rate
- You know your average profit/loss
- You know your maximum drawdown
- You trade with confidence
How to Backtest in MT5
Step 1: Open Strategy Tester
- Open MT5
- View → Strategy Tester (or press Ctrl+R)
- Strategy Tester window opens
Step 2: Select Your Strategy
Option A: Expert Advisor (EA)
- Expert: Select your EA from dropdown
- Symbol: Choose currency pair (e.g., EURUSD)
- Period: Choose timeframe (e.g., H1)
Option B: Manual Strategy
- Use MT5's built-in strategy tester
- Or create custom EA for your strategy
Step 3: Set Parameters
Common Settings:
- Symbol: EURUSD (or your pair)
- Period: H1 (or your timeframe)
- Date Range: Start and end dates
- Model: "Every tick" (most accurate)
- Deposit: Starting account balance (e.g., $10,000)
Advanced Settings:
- Spread: Set realistic spread (e.g., 2 pips)
- Commission: If applicable
- Slippage: Account for execution delays
Step 4: Run Backtest
- Click "Start" button
- Watch progress bar
- Results appear when complete
Step 5: Analyze Results
Key Metrics:
- Total Net Profit: Overall profit/loss
- Profit Factor: Gross profit / Gross loss (should be > 1.5)
- Win Rate: Percentage of winning trades
- Average Win/Loss: Average profit per trade
- Maximum Drawdown: Largest peak-to-trough decline
- Sharpe Ratio: Risk-adjusted return (higher is better)
What Makes a Good Backtest?
Criteria for Success
Minimum Requirements:
- Profit Factor: > 1.5 (gross profit 1.5x gross loss)
- Win Rate: > 50% (or high risk/reward if lower)
- Maximum Drawdown: < 20% of account
- Number of Trades: > 100 (statistically significant)
Ideal Results:
- Profit Factor: > 2.0
- Win Rate: > 55%
- Maximum Drawdown: < 15%
- Number of Trades: > 200
- Sharpe Ratio: > 1.0
Red Flags
Warning Signs:
- Too Few Trades: < 50 trades (not statistically significant)
- Huge Drawdown: > 30% (too risky)
- Profit Factor < 1.0: Losing strategy
- Overfitting: Perfect results (too good to be true)
Common Backtesting Mistakes
Mistake #1: Overfitting
What It Is: Optimizing parameters to fit historical data perfectly.
Example:
- You test 100 different parameter combinations
- You pick the one with best results
- It works in backtest, fails in live trading
Why It Fails:
- Strategy is too specific to historical data
- Doesn't work on new data
- Curve fitting, not real edge
The Fix:
- Don't over-optimize: Use reasonable parameters
- Out-of-Sample Testing: Test on data not used for optimization
- Walk-Forward Analysis: Test on multiple time periods
Mistake #2: Unrealistic Assumptions
Common Mistakes:
- No Spread: Assuming zero spread (unrealistic)
- No Slippage: Assuming perfect execution
- No Commission: Ignoring trading costs
- Perfect Fills: Assuming all orders fill at exact price
The Fix:
- Use Realistic Spreads: 1-3 pips for majors
- Account for Slippage: 1-2 pips on market orders
- Include Commission: If applicable
- Use "Every Tick" Model: Most accurate
Mistake #3: Too Short Time Period
What It Is: Testing on only 1-2 months of data.
Why It's Bad:
- Not enough data for statistical significance
- Doesn't account for different market conditions
- Results may be luck, not strategy
The Fix:
- Test Minimum 1 Year: Preferably 2-3 years
- Include Different Market Conditions: Bull, bear, sideways
- Multiple Currency Pairs: Test on different pairs
Mistake #4: Ignoring Drawdowns
What It Is: Focusing only on profits, ignoring losses.
Why It's Bad:
- Maximum drawdown shows real risk
- You might not survive the drawdown
- Emotional impact of large losses
The Fix:
- Check Maximum Drawdown: Should be < 20%
- Check Consecutive Losses: How many in a row?
- Check Recovery Time: How long to recover from drawdown?
Optimizing Your Strategy
Parameter Optimization
What It Is: Testing different parameter values to find best settings.
Example:
- Moving Average period: 10, 20, 30, 50, 100
- Test each, find best result
How to Optimize:
- MT5 Strategy Tester: Use "Optimization" tab
- Set Range: Min and max values
- Set Step: Increment size (e.g., 5)
- Run Optimization: Tests all combinations
- Review Results: Find best parameters
Warning:
- Don't Over-Optimize: Use reasonable ranges
- Test Out-of-Sample: Verify on new data
- Use Walk-Forward: Test on multiple periods
Walk-Forward Analysis
What It Is: Testing strategy on multiple time periods to verify robustness.
Process:
- Optimize on Period 1: Find best parameters
- Test on Period 2: Verify it works
- Optimize on Period 2: Find new parameters
- Test on Period 3: Verify again
- Repeat: Multiple periods
Why It Works:
- Tests strategy on different market conditions
- Verifies it's not overfitted
- More realistic than single backtest
Interpreting Backtest Results
Key Metrics Explained
Total Net Profit:
- Overall profit/loss
- Should be positive and significant
Profit Factor:
- Gross Profit / Gross Loss
-
1.5 = Good, > 2.0 = Excellent
Win Rate:
- Percentage of winning trades
-
50% = Good, > 60% = Excellent
- Can be lower if risk/reward is high (e.g., 40% win rate with 1:3 R/R)
Average Win vs Average Loss:
- Average Win should be > Average Loss
- Ideally 2x or 3x (risk/reward ratio)
Maximum Drawdown:
- Largest peak-to-trough decline
- < 15% = Good, < 20% = Acceptable, > 30% = Risky
Sharpe Ratio:
- Risk-adjusted return
-
1.0 = Good, > 2.0 = Excellent
From Backtest to Live Trading
The Gap
Backtest Results ≠ Live Results
Why?
- Slippage: Real execution has delays
- Spread Widening: Spreads widen during news
- Emotions: Fear and greed affect decisions
- Market Conditions: Current market may differ from historical
Bridging the Gap
Step 1: Demo Trading
- Test strategy on demo account
- Trade for 1-3 months
- Compare results to backtest
Step 2: Small Live Account
- Start with small account
- Trade with same rules as backtest
- Monitor performance closely
Step 3: Scale Up
- If demo and small live account match backtest
- Gradually increase position sizes
- Continue monitoring
Summary
Backtesting is essential for professional trading. It separates profitable strategies from losing ones before you risk real money.
Key Takeaways:
- Always backtest before live trading
- Test minimum 1 year of data
- Use realistic assumptions (spreads, slippage)
- Don't over-optimize (avoid overfitting)
- Check all metrics (profit, drawdown, win rate)
- Verify with demo and small live account
Remember: A good backtest doesn't guarantee profits, but a bad backtest guarantees losses.