Three gold series and why they differ
The futures record comes from the exchange, with contract months, expiries and a roll. It carries real traded volume and official session times, and it includes the price steps of the contract rather than a dealer quote.
The spot record is the dealer market in unallocated metal, quoted continuously in dollars per ounce. It has no expiry and no central volume, and the price sits slightly away from the front futures contract because of financing and storage.
Your broker feed is a filtered version of the spot market with the broker own spread applied and its own server clock. This third one is what you will actually trade, which is why it is the one your backtest should use.
The candle boundary problem
A daily candle is defined by where you cut the day. Brokers set that cut by their server time, and server times differ, often by hours. The same week of gold prices can therefore produce daily candles with different highs, lows and closes on two platforms.
This matters because many rules depend on the daily close: a break confirmed by a close, a level taken from the prior day high, a bias set by yesterday direction. Shift the cut and some of those events appear or disappear.
The practical cut for gold is the end of the New York session, around five in the afternoon New York time, because that is when the maintenance break falls and when the market genuinely pauses. If your data cuts elsewhere, say so when you report a result.
Gaps, breaks and the weekend
Spot gold trades from Sunday evening to Friday evening New York time with a short daily maintenance break. That produces one certain gap every week at the weekly open and a small discontinuity every day.
Backtests handle these badly by default. A stop that sits inside a weekend gap will be filled at the gap price in reality and at the stop price in many testing tools, which quietly improves every result involving an overnight hold.
Holiday sessions add thinner versions of the same problem. Prices exist, spreads are wide, and a rule triggered in those hours would have filled far from the recorded price.
Volume in the file is not traded volume
The volume on a spot gold chart is tick volume, the number of price changes in the period, not lots traded. It is a count of quote updates from the dealer feed.
It is still useful. Relative volume built from tick counts tracks genuine activity closely, so a session comparison or a relative reading against the last twenty periods carries real information.
What you cannot do is treat the number as size. Any rule that assumes a figure represents contracts or ounces is testing an invented quantity, and any threshold copied from a futures study will not transfer to a spot file.
Cleaning before testing
Raw exports arrive with defects that change results. Work through them before the first run rather than explaining a surprising result afterwards.
- Duplicate timestamps and repeated bars, common around session rollovers.
- Single tick spikes that print a high or low nobody traded, which will trigger level based rules.
- Missing periods during holidays, which some tools fill by carrying the last price forward.
- Daylight saving shifts, which move every session boundary twice a year.
Then check the obvious events by eye. Look at a few known data releases and confirm the bars show the expansion you remember. If they do not, the file is wrong.
What a test on bad data actually produces
Usually an optimistic result, because most defects help the strategy. Spikes trigger entries at prices that did not exist, gaps are filled at the requested level instead of the real one, and forward filled holiday bars remove losing periods.
The dangerous part is that the result still looks plausible. A smooth curve on a bad file is more convincing than a rough curve on a clean one, and the rougher curve is the honest one.
Our own measured findings on gold came from running rules on a cleaned broker feed, and several of them were negative: fair value gap entries showed no measurable edge in two years, and the pattern based rules we tested lost their results once look ahead bias was removed. Those are the kinds of answers a clean file gives.
The costs your file does not include
Price history contains no spread, no commission and no swap. Adding them is not optional on gold, where the spread widens around releases and swap is charged daily on held positions with a triple charge one day a week.
Model the spread as a variable rather than a constant: narrow in London, wider in late New York, far wider in the first seconds after a scheduled print. A strategy whose average target is a few dollars can be entirely consumed by this.
Slippage deserves the same treatment on the stop side. Assume stops fill worse than they read, particularly any rule that holds through a release.
A data routine that keeps results trustworthy
Export from the account you intend to trade, note the server time offset, and record the date range and the number of bars in the same place as the result. A result without that note cannot be reproduced, including by you in six months.
Keep one cleaned file as the reference and test every new idea against it, rather than re exporting each time and quietly changing the sample. Then repeat the best candidates on a second feed to see whether the result survives a different candle boundary.
The procedure around all of this matters as much as the data, and our guide on how to backtest a gold strategy properly covers the testing side in detail.
FAQ
Where can you get gold historical data for backtesting?
The most useful source is an export from the broker account you plan to trade, because it already contains that platform spreads, session boundaries and gaps. Exchange records for gold futures are cleaner and carry real traded volume, but they describe a different instrument with contract rolls and will not match your spot chart exactly.
Does spot gold data differ from gold futures data?
Yes, in three ways that matter. The price level differs because of financing and storage costs, the session times differ, and futures carry real traded volume while spot charts carry tick volume. Futures also have expiries and a roll, which creates artificial jumps in a continuous contract series unless the series is adjusted.
How much gold history do you need for a backtest?
Enough to include several market characters rather than a fixed span: a quiet range period, a trending period driven by rate expectations, and at least a few high volatility events. Two years is a reasonable minimum for intraday rules. The number of trades matters more than the number of years, since a rule that fires rarely needs a longer sample.
Why do my backtest results change on a different broker feed?
Because the daily candle is cut at a different server time, the spreads differ, and each feed records slightly different highs and lows. Rules that depend on daily closes or on prior session extremes are the most sensitive. If a result does not survive a second feed, the result was describing the data rather than the market.
ⓘ See these ideas on real price: open the free XAUUSD live chart.