How to backtest a gold EA in MT5 properly
Updated5 min read
MetaTrader 5Strategy TesterBacktesting
- Use Every tick based on real ticks where your broker has them, and read History Quality as the warning it is.
- The MT5 tester models fills and, on many gold feeds, charges no commission — so a tester result is not a live result.
- Run your own window on your own broker’s data. A run you did not make proves nothing to you.
The point of a backtest is not to produce a good number. It is to find out under what conditions a set of rules stopped working. A run set up to flatter a strategy will do that reliably, and it will teach you nothing, so this guide is mostly about the settings that decide whether a result means anything.
Open the Strategy Tester and pick the right things
In MetaTrader 5 the tester is a panel at the bottom of the terminal
(MetaTrader 5 Help).
Choose the Expert Advisor, choose XAUUSD as your broker spells it — many spell
it XAUUSD+, XAUUSD.a or similar, and the symbol you pick is the tick data
you get — then set the date range, the deposit and the modelling mode.
Load the .set preset that shipped with the download from the Inputs tab.
A run on the defaults is a run of a different strategy.
Modelling mode: real ticks, or modelled ones
The mode is the single biggest lever on whether the result resembles trading.
Every tick based on real ticks uses the actual tick history your broker recorded and stored. It is the most accurate mode MetaTrader 5 offers, and it is also the slowest.
Every tick generates a plausible tick sequence from M1 bars instead. It is much faster and, for a strategy that reacts inside a bar, materially different.
The tester will silently fall back from the first to the second: where real ticks are missing for a period, it simulates that period as if you had chosen Every tick. It does not refuse the run. It reports the shortfall as History Quality instead (MetaTrader 5 Help).
History Quality is the number to read first
History Quality sits at the top of the report and tells you how much of the window was covered by real ticks. It is not a score of the strategy. It is a score of the evidence.
Our own 2026 campaign is a worked example of why it matters. Running on IC Markets demo data for 2026-01-01 to 2026-09-07, the desk’s Strategy Tester runs came back at History Quality 63 %: that broker serves real ticks only from 2026-04-21, so January to April were synthesised by the tester from M1 bars. Every conclusion about the first four months of that window is therefore an approximation, and the campaign notes say exactly that.
A run at 99 % on a two-month window can be worth more than a run at 60 % on two years. Read the two numbers together, always.
Spread and commission: what the tester does not charge you
Two costs decide whether a gold strategy that looks viable actually is, and the tester handles both loosely.
Spread. XAUUSD has no exchange-set spread; it is quoted by your broker, and what the tester uses is whatever you tell it — the current spread, or a fixed value you type. A fixed spread taken at a calm hour will not resemble the spread at the daily futures break or during a scheduled release.
Commission. This is the trap. On the feed the desk tested, the MetaTrader 5 tester charged $0 commission on XAUUSD, while live trading on the account the desk used cost roughly $7 per lot round-turn. A strategy that turns over hundreds of lots therefore looks several thousand dollars better in the tester than it would have been. Our own campaign tables carry an added column for exactly this — estimated commission, and net after it — because the tester’s own net is not the number to argue from.
The two departures every XauStack figure carries
We publish the departures rather than hiding them, and they are the same two for any MetaTrader 5 result you will ever read:
- No commission is charged by the tester on the feed used, so gross costs are understated.
- Fills are modelled. The tester decides at what price an order would have filled. A live broker decides that with real liquidity, real slippage and real requotes, and the two disagree most exactly when a market moves fastest.
That is why every figure on this site is labelled Strategy Tester and why none of them is offered as a forecast.
One window is one story
The other limit is the window itself. The desk’s 2026 runs cover a strong year for gold, and a strategy with a directional bias will look excellent in one. The same rule sets, run over 2023 and 2024 in the desk’s earlier Strategy Tester work, produced losing years for several families that ranked near the top of the 2026 table.
So: test more than one year. Test a flat year. Test a year that went the wrong way. If a strategy only survives the window you chose, you have measured the window.
A sane routine
- Run the same preset over three or four separate windows rather than one long one, and compare the shapes, not just the ends.
- Run at two deposit sizes. Fixed-lot strategies post the same money at both, so the deposit is what moves the drawdown percentage; risk-sized ones scale.
- Re-run with a wider fixed spread and again with commission subtracted by hand before you decide anything.
- Keep the report. A number you cannot trace to a run is a claim, not a result.
Before you act on any of this
Every figure XauStack publishes comes from the MetaTrader 5 Strategy Tester, never from live trading, and no result is promised anywhere on this site. Backtests describe the past of one data set. Read the risk disclosure, and then read how to read a backtest report to work out what your own run is telling you.
Read next
How to read an MT5 backtest report
Net profit, drawdown, profit factor, recovery factor and trade count — what each one is measuring, and which values should stop you reading further.
How to install an Expert Advisor on MetaTrader 5
Where the .ex5 file goes, how to find the MT5 data folder, where presets live, and how to attach an Expert Advisor to an XAUUSD chart without guesswork.