Study ›
[Course] [Build an EA 6] Backtesting and reading the results
Once you've built an EA, run it on historical data (backtest) before putting in real money. MT5's Strategy Tester checks years of data in minutes.
1. Open the Strategy Tester
- In MT5: View → Strategy Tester (shortcut Ctrl+R)
- The settings panel opens at the bottom.
2. Settings
- Expert: MyFirstEA
- Symbol: XAUUSD / Timeframe: M15
- Dates: at least 2 years (e.g. the last 3). Too short and you may only see a lucky stretch.
- Modeling: Every tick based on real ticks (most accurate, slow). Start with "1 minute OHLC" for speed and confirm with real ticks at the end.
- Deposit: close to what you'd really use / Leverage: same as your real account
- Press Start
3. Five things to check in the results
- Total net profit: did it make or lose money?
- Maximal drawdown: how far it fell from a peak. This matters more than profit. A 30% drawdown means $10,000 went down to $7,000. Ask yourself whether you could really sit through that.
- Profit factor: money won ÷ money lost. 1.3+ is decent; below 1.0 it loses money.
- Number of trades: you need 100+ to trust the result. Ten winning trades could be luck.
- Shape of the curve: does it climb steadily to the upper right? If it jumped in one step, it may be a lucky shot.
4. The trap: overfitting
Tweak settings until they fit the past perfectly and the backtest looks great but falls apart live. That's overfitting. How to avoid it:
- Split the period. Find settings on the first 2 years, then confirm on the untouched last year.
- If 20/50 worked, check that 18/45 and 22/55 also work. If nearby numbers suddenly fail, it was chance.
- The more conditions you add, the higher the risk. Simple lasts longer.
5. Include spread and commission
Set the tester's spread close to your real broker's. For EAs that trade often and briefly, the spread alone can flip profit into loss.
Post your backtest on Verified strategies for feedback. But a backtest is not live trading. Next we'll move to demo and live.
