How to Backtest an EA Properly: Data, Spreads, Periods
A backtest is a simulation, not a preview of your account. This guide covers what MT4 and MT5 reports actually measure, how data quality is scored, and how to set spreads, commission and test periods so the result is honest.
Key takeaways
- A backtest report is hypothetical performance, not the record of any real account, and it cannot show you broker fills, latency or your own behaviour under drawdown.
- MT4 modelling quality and MT5 history quality measure different things; neither one means the simulation matched live trading conditions.
- MT4's spread box freezes the spread at the moment you pressed Start and it has no commission field at all, so an unadjusted test can understate costs heavily.
- Optimising thousands of parameter sets on one dataset can produce overfitted settings that look excellent and carry no predictive power.
In this article
- What a backtest measures, and what it cannot
- Reading the quality number in the report
- Modelling mode: every tick is not always every tick
- Spreads and commission: the costs the tester forgets
- Choosing a test period, and the trade-off inside it
- Overfitting: the failure mode that looks like success
- Worked example: what an understated spread costs
- A checklist to run before you trust a report
What a backtest measures, and what it cannot
When you run an EA through the Strategy Tester, the software steps through historical prices and applies the EA's rules. The report that comes out is hypothetical performance. It is not the record of any real account. The SBAI's guidance on backtesting is explicit on this: backtesting results constitute hypothetical performance information, not actual past performance, and managers and broker dealers using backtesting have to provide clear disclosure explaining how the results were derived, that the result is not the performance of any actual account and that it is not a guarantee of future results.
So what does a backtest actually tell you? That the logic runs without breaking. That entries, exits, stop losses and position sizes happen where the code says they should. And roughly how those rules would have behaved across the price history you fed in. That is genuinely useful.
The FCA requires investment firms to establish clearly delineated methodologies for testing algorithmic trading systems before deployment. It also requires that testing of compliance with the criteria in Article 5(4)(a), (b) and (d) be carried out in an environment separated from the production environment and used specifically for testing and development. That text is written for investment firms, and the FCA sources do not say anything about retail traders running a personal account. The parallel I draw below is my own reading, not a regulatory statement: the value of a simulation is that it can surface a logic or coding failure before it costs real money.
What it cannot tell you: how the EA behaves when your broker's spread triples on a news release, how a connection drop during the session roll affects a pending order, or whether you personally will keep running it through a flat six-month stretch. Those decide outcomes, and none of them appear in the report.
Reading the quality number in the report
Both platforms print a data quality figure. They do not mean the same thing, and neither is a promise.
MT4 — “Modelling quality”. This shows the overall quality of the data used, and in one published example it reads 99%. That number needs context. MT4 usually uses broker data, which has a maximum quality level of 90% and can be much lower. Third-party tools such as Tick Data Suite enable the use of cleaned data — errors removed — and the same source notes that data errors sometimes arise in real time and are not always corrected by brokers later. The MT4 report also lists “mismatched charts errors”, meaning inconsistencies between data from different timeframes; the example shows 0 such errors for that test.
MT5 — “History Quality”. This is calculated mainly from the consistency of M1 (one-minute) data. The official definition describes it as the percentage ratio of “correct M1 data” versus “incorrect M1 data”, and gaps in the data are counted as incorrect. MT5 scores segments of the test period and aggregates them, so read the figure as a rough indicator of how consistently reliable the one-minute history is, not as a simple exists-or-doesn't-exist flag.
One more detail worth knowing: even with “Every tick based on real ticks” selected, MT5 still treats M1 as the main reference for consistency. If M1 exists for a minute but real ticks are missing, MT5 can generate ticks to fill the gap; if ticks exist but M1 does not, those ticks can be ignored.
Modelling mode: every tick is not always every tick
In MT4, “Model” refers to the level of detail or granularity of the data, and the recommended choice is “Every tick”. The catch is that even with that selected, broker data may not contain tick data at all, in which case the tester uses one-minute data to estimate — interpolate — how price moved inside each minute.
That interpolation has a specific consequence inside the simulation. As Birt of Tick Data Suite puts it, during MT4's backtesting interpolation routine, “if a position has both its SL and its TP within a bar's price range, it's a coin toss whether it will hit stop/loss or take profit.” On a quiet one-minute bar that rarely matters. On a minute that spans a wide range it matters a great deal, and the outcome of that coin toss is not a record of what actually happened in the market.
In MT5, “Every tick based on real ticks” is the setting to aim for when your broker's history supports it. Where it does not, you are working with generated ticks. My own view is that a generated price path is a weaker basis for judgement than a genuine tick recording, even though it is clearly more informative than no test at all.
Spreads and commission: the costs the tester forgets
Cost assumptions are where a plausible-looking backtest can come apart, because every cost the tester does not model is a cost your live account pays anyway.
In MT4, the spread box defaults to Current — the spread at the exact moment you pressed Start, frozen across the entire history. Press Start on a Sunday evening and you have just tested years of trading at a weekend spread. Enter a fixed value in points instead, and pick a pessimistic one: not the broker's advertised typical spread, but something closer to what you actually meet around news and at the session roll.
In MT4, the tester has no concept of commission at all. The usual workarounds are to set the spread high enough to swallow your round-turn commission, or to subtract commission per trade from the report by hand. MT5 handles it through the symbol's contract settings. On MT5 with real ticks, historical spread arrives with the tick data, and “Variable spread” is the option to use if your data supports it.
| Cost | MT4 Strategy Tester | MT5 Strategy Tester |
|---|---|---|
| Spread | Defaults to Current, frozen at the moment you pressed Start. Set a fixed, pessimistic value in points. | Comes with real tick data; use “Variable spread” where supported. |
| Commission | No concept of commission. Inflate the spread to cover it, or subtract per trade by hand. | Handled through the symbol's contract settings. |
| Granularity | “Every tick” is best, but broker data may lack ticks and be interpolated from one-minute bars. | “Every tick based on real ticks” is the most accurate option, still referenced to M1. |
A fixed spread of 10 or 15 points is a fallback, not a realistic setting, because it does not account for spread widening during news or in thin sessions — exactly when many EAs open trades.
Choosing a test period, and the trade-off inside it
Longer is not automatically better. Data quality usually falls as the backtest period lengthens; quality can be around 99% to 100% for just the past few years and deteriorate as you reach further back. So there is a genuine trade-off between covering more market regimes and testing on cleaner data.
One guide recommends a minimum five-year range, with 2020–2025 suggested as a baseline because it includes the COVID crash and recovery, the 2022–2023 rate hiking cycle, and more recent ranging conditions. That is a reasonable default to start from: three quite different environments in one stretch. Treat it as that guide's suggestion rather than a rule handed down from anywhere.
Whatever you pick, split it. Optimise on one part and evaluate on a part the optimiser never saw. If the rules fall apart out of sample, you have learned something important for the price of an afternoon. Also resist the temptation to test only the years you already know were kind to the approach — the point is to find out where it struggles, not to collect a flattering chart.
Overfitting: the failure mode that looks like success
The SBAI identifies “statistical overfitting bias” as a key challenge in strategy development: it arises when a strategy is fitted too closely to the underlying historic dataset but might not work well in the future. In situations where computers can test thousands or millions of configurations on one sample to find the optimum, it is very likely that the chosen configuration is overfitted, with no superior predictive power going forward.
That matters for retail EA users as much as for institutions. When a backtest screen shows one parameter set dramatically outperforming its neighbours, one possible explanation is that the setting is tracking noise specific to that sample rather than a repeatable behaviour — which is exactly the overfitting problem the SBAI describes.
Practical defences: prefer EAs with few tunable inputs; refuse to judge on a single optimised run; check whether a range of nearby settings all behave similarly rather than one standing alone; and never re-optimise after seeing live results and call the new settings “validated”. The SBAI's position is that firms using backtesting need frameworks and methods to vet strategies and prevent backtest overfit. A retail trader can apply the same discipline in miniature.
Worked example: what an understated spread costs
Hypothetical numbers throughout. Assume one lot of gold is 100 ounces and one point is 0.01 in price — check your own broker's contract specification, because these details vary by symbol and account type. Assume your broker's realistic average spread in the hours the EA trades is 0.30 in price — 30 points — and, purely for illustration, commission of $7 per lot per side, so $14 round turn.
Cost per round turn in live conditions: 0.30 × 100 = $30 spread, plus $14 commission = $44.
Now the test. It was run on MT4 at a fixed 10 points, with no commission modelled: 0.10 × 100 = $10 per trade.
The gap is $34 per round turn. Over a hypothetical 200 trades on one lot each, that is 200 × $34 = $6,800 of cost that the test never charged. If the average winner in that test was worth 300 points — $300 at one lot — then on each trade the test understated costs by about 11% of that winner's gross value. Across a few hundred trades, a marginal edge becomes a flat line.
That is why spread and commission settings are not a detail to fix later. They are part of the test. If you are unsure how points convert into dollars on XAUUSD, work that out before you open the tester — the guide to pips in gold covers the conversion.
A checklist to run before you trust a report
- Check the data quality figure and where the data came from. Broker data or imported ticks? MT4 modelling quality or MT5 history quality? If the number is suspiciously perfect, ask why.
- Confirm the modelling mode. “Every tick” on interpolated one-minute data is not the same as real ticks.
- Replace the spread. Never leave MT4's spread box on Current. Use a pessimistic fixed value, or real-tick variable spread on MT5.
- Add commission. Inflate the spread or subtract it by hand in MT4; check contract settings in MT5.
- Split your period. Optimise on one window, evaluate on another, and include at least one stretch you would rather not see.
- Look at the drawdown, not just the end number. How deep it went and how long it stayed there matters more than the final balance; the drawdown guide covers the definitions.
- Sanity-check the trade economics. Compare the average winner with the average loser and ask what win rate the report needs in order to break even. If that number looks implausible, treat the report with suspicion.
Finally, a disclosure: this site sells an EA, Gold Rush Algo, so weigh what we say about backtesting with that interest in mind. Whether you are testing our product or anyone else's, the useful move is to reproduce the test on your own broker's data rather than accept someone else's run at face value. Same settings, same period, your spreads. If the result changes shape dramatically, you have found something more useful than the original chart.
Frequently asked questions
Does a 99% modelling quality score mean the backtest is accurate?
No. In MT4 the figure describes the overall quality of the data used, and broker data usually maxes out at 90% and can be far lower. It says nothing about whether your spread, commission or execution assumptions matched live conditions.
Why does MT4's backtest look better than my live results?
Cost modelling is one place to look first. MT4's spread box freezes whatever spread existed when you pressed Start, and the tester has no commission field at all, so both can understate what you pay in live trading.
How long should a backtest period be?
One guide recommends a minimum of five years, suggesting 2020–2025 as a baseline because it spans the COVID crash and recovery, the 2022–2023 hiking cycle and more recent ranging conditions. Bear in mind data quality typically falls the further back you go.
What is overfitting in a backtest?
It is fitting a strategy so closely to one historical dataset that it captures noise rather than a repeatable behaviour. The result looks strong on that data and can carry no predictive power on anything new.
Free tools mentioned in this article
Related guides: What is a pip in gold?, What is drawdown?.
Sources
- Performance Metrics — Data Quality (Part 3 of 4) – The IQT
- How to Backtest an EA on MetaTrader (MT4 & MT5) – SignalBots Blog
- MT5 Backtest Modeling & History Quality Explained: Real Ticks, Costs, and What to Trust – Forex Robot Lab
- How to Backtest a Forex EA Properly — Complete Guide (2026) – Forex EA Watch
- How to use Strategy tester in Metatrader – 747Developments
- Backtesting – SBAI
- FCA Handbook — SECTION I Testing and deployment of trading algorithms systems and strategies – FCA
Sources checked on 3 November 2026. Rules and figures from third parties can change, so check the original before relying on them.
More from the blog
Want to test an EA on your own platform?
Gold Rush Algo is an MT5 Expert Advisor for XAUUSD. Download the free backtest version and judge it with your own numbers before deciding anything.
