How to Backtest an EA in the MT4 Strategy Tester
If you want to know whether an expert advisor actually works before risking real money, you need to backtest an EA in the MT4 Strategy Tester properly — not just click "Start" and hope for a nice equity curve. Done right, backtesting tells you how a strategy behaves across different market conditions and gives you realistic expectations for drawdown, win rate, and cost sensitivity. Done badly, it just produces an expensive illusion.
What the MT4 Strategy Tester Actually Does
The Strategy Tester simulates your EA's trading logic against historical price data stored on your terminal. It opens a position exactly as your EA would, applies spread and slippage settings, and logs every trade so you can review performance afterwards.
Key things to understand before you touch a single setting:
- It only tests one symbol at a time by default, unless you're running multi-currency testing with a basket EA designed for it.
- Tick data quality varies hugely by broker and symbol. MT4's built-in history is often thin for anything beyond the last few years, especially on less popular pairs.
- Modelling quality matters more than most traders realise. "Every tick" is the closest MT4 gets to real tick-by-tick simulation, but it's reconstructed from available minute data, not a perfect record of every historical tick that ever traded.
- The tester doesn't know about your broker's real execution. Requotes, partial fills, and genuine slippage during news events are approximated at best.
Treat the Strategy Tester as a filter for obviously broken ideas, not a crystal ball. It tells you whether a strategy is worth testing further on a demo account — not whether it will make money live.
Setting Up the Strategy Tester Step by Step
1. Open MT4 and go to View > Strategy Tester (or press Ctrl+R). 2. Select your Expert Advisor from the dropdown. 3. Choose the Symbol and Period (timeframe) you intend to trade live. 4. Set the Model to "Every tick" for the most rigorous simulation — it's slower but far more reliable than "Open prices only." 5. Define your date range — test across at least 2-3 years if data allows, covering both trending and ranging conditions. 6. Set Spread — you can use "Current" or enter a fixed value manually. This is where most backtests go wrong (more below). 7. Tick Visual mode only when you want to watch trades unfold in slow motion for debugging — leave it off for full-speed runs. 8. Click Start.
Before running anything meaningful, use the History Centre (Tools > History Centre) to download or update tick data for the symbol and timeframe you're testing. Thin or gappy data produces misleading results no matter how good the EA logic is.
Getting Spread and Costs Right
This is the single biggest reason backtests look better than live results. MT4's default tester often uses a fixed or current spread that doesn't reflect what you'd actually pay at different times of day or during news.
To make your test realistic:
- Enter a fixed spread manually that reflects a realistic average for the symbol and broker you plan to trade with, not the tightest moment you've ever seen quoted.
- Remember spread is only part of the cost. Commission-based accounts (common on ECN/Raw accounts at brokers like Pepperstone) charge per-lot commission on top of a tighter spread — the tester won't add this automatically unless your EA code accounts for it or you're using a custom cost model.
- Check swap/rollover costs separately if your EA holds trades overnight — these aren't always reflected clearly in the tester's summary.
- Run the same strategy at different realistic spread levels to see how sensitive its profitability is. A strategy that only works at near-zero spread is not robust.
Because spreads, commissions and swaps vary by broker and account type, don't guess — pull live, comparable numbers from PipTax's [cost tool](/audit.html) and the [broker pages](/brokers/index.html) before you finalise your test assumptions. Testing IG's platform spread against Pepperstone's raw account commission structure, for example, can produce very different net results from the same EA logic.
Reading the Results Report Honestly
After a run, MT4 generates a results tab with dozens of stats. The ones that actually matter:
| Metric | Why it matters | |---|---| | Total net profit | Meaningless alone — always compare against drawdown | | Maximum drawdown (%) | The real risk measure; can you stomach this live? | | Profit factor | Gross profit ÷ gross loss; above 1.3-1.5 is a reasonable starting bar | | Number of trades | Too few (under ~100) means the sample isn't statistically meaningful | | Consecutive losses | Tells you the psychological pain you'd need to tolerate |
Be sceptical of a smooth, ever-rising equity curve — it often signals over-fitting (the EA was tuned to match historical quirks rather than a genuine edge) or an unrealistic spread/cost setting. A choppier, more "real-looking" curve with a reasonable profit factor is often more trustworthy than a picture-perfect one.
Common Backtesting Mistakes to Avoid
- Curve-fitting parameters to historical data until it looks perfect — this guarantees poor live performance.
- Testing on too short a period — a few months rarely covers enough variety of market conditions.
- Ignoring broker-specific execution differences — an EA tested on one broker's feed may behave differently on another's due to spread, swap, and fill variations.
- Skipping forward testing — always follow a backtest with a demo run on the broker and account type you intend to use live.
- Forgetting News/FTMO-style filters — if your EA avoids news, make sure that logic is actually active during the test, not just in theory.
Moving From Backtest to Demo to Live
A backtest is step one of three, not the final word:
1. Backtest across multiple years and realistic cost assumptions in the MT4 Strategy Tester. 2. Forward test on a demo account with your chosen broker for at least a few weeks, ideally through a mix of market conditions. 3. Go live with reduced size and compare actual fills, spread, and slippage against what the backtest assumed.
If live results diverge sharply from backtested ones, the gap is almost always costs — spread, commission, or swap — rather than the EA's logic itself. That's exactly why checking real numbers via PipTax's [cost impact tool](/cost-impact.html) alongside your backtest is worth the ten minutes it takes.
Conclusion
Learning to backtest an EA in the MT4 Strategy Tester properly — with honest spread assumptions, sufficient data, and a sceptical eye on the results — is one of the most useful skills a systematic trader can build. It won't tell you an EA will definitely work, but it will quickly tell you if one definitely won't. Pair every backtest with forward demo testing and real cost comparisons before committing live capital, and you'll avoid the single most common mistake retail EA traders make: trusting a backtest that was never realistic in the first place.
Key takeaways
- Always use 'Every tick' modelling and download fresh history data before running a meaningful backtest
- Manually set a realistic fixed spread — default settings often understate real trading costs
- A profit factor above 1.3-1.5 with a reasonable drawdown is a better signal than a perfectly smooth equity curve
- Over-fitted EAs with too-perfect backtests almost always underperform live
- Follow every backtest with demo forward testing on your actual broker and account type before going live
- Check live spread, commission and swap data via the cost tool rather than guessing at numbers
Frequently asked questions
- What's the difference between 'Every tick' and 'Open prices only' modelling in MT4?
- 'Every tick' reconstructs intrabar price movement for a much more realistic simulation of how your EA would have traded, while 'Open prices only' just uses one price per bar and is far less accurate. Always use 'Every tick' for serious testing, even though it's slower.
- How much historical data do I need to backtest an EA properly?
- Aim for at least 2-3 years where data allows, covering a mix of trending, ranging, and volatile periods. Testing over just a few months risks drawing conclusions from a market condition that won't repeat.
- Does the MT4 Strategy Tester account for broker commission automatically?
- Not by default — the tester primarily models spread. If you're testing against a commission-based ECN/Raw account, you'll need to factor commission in manually or via EA code, and check real figures on the broker pages before assuming a cost structure.
- Why does my EA perform well in backtest but lose money live?
- This is almost always down to costs or execution differences — unrealistic spread assumptions, missing commission or swap costs, or slippage the tester couldn't simulate. Compare your backtest assumptions against live numbers using the cost tool.
- Should I trust a backtest with a smooth, consistently rising equity curve?
- Be cautious. A suspiciously smooth curve often indicates over-fitting to historical data or unrealistic cost settings rather than a genuine, robust trading edge.
- What should I do after a successful backtest, before going live?
- Run the EA on a demo account with your intended broker for several weeks to forward test it under real market conditions, then go live with reduced position size and compare actual fills against your backtest assumptions.