Backtesting a Gold Strategy on Historical Data
Gold is many people's first serious backtest — trending enough to be encouraging, liquid enough to feel tradable. It is also a series with three traps that generic backtesting advice never mentions, because they are specifically gold-shaped. This guide picks the right granularity for the strategy you're testing, walks the regimes the archive actually covers, and names the traps before they name themselves in your equity curve.
Get the app — €9 →
Pick the granularity the strategy needs — not the most
The XAU/USD archive runs from monthly candles down to raw ticks, and the right choice follows the strategy's holding period:
- Position/regime systems (weeks–months) — daily candles, from 1999-06-03: the deepest gold series here, small enough to iterate on instantly.
- Swing systems (days) — 1-hour or 4-hour candles; still compact, but the entry timing inside the day becomes real.
- Intraday systems (minutes–hours) — 1-minute or 5-minute candles from 2003-05-05.
- Spread- or fill-sensitive systems — tick data, and accept the shorter window: the tick era is your effective history.
File sizes per timeframe are on the instrument page; the general trade-offs in tick vs OHLC.
What the history actually spans
The daily series from 1999-06-03 covers the entire 2000s bull market, the 2011 top, the 2013 crash, the 2015 trough and everything since — several genuinely different regimes: trending, mean-reverting, quiet, violent. That breadth is the point of backtesting gold on decades rather than years — a strategy tuned on one regime and shown the others is where most gold curve-fits die. Walk-forward validation and the other generic defences are in the main backtesting guide; they all apply here.
The three gold-specific traps
- The daily cut-off. Spot gold trades ~23 hours, so "the daily close" is a convention, not a fact of the market — platforms cut the day at different hours, and a strategy keyed to daily opens/closes can look different under a different cut-off. This archive's timestamps are UTC; test your rule against the cut-off you will actually trade on.
- Weekend gaps. Gold closes for the weekend; Monday opens gap. A backtest that fills at Friday's close for a Monday signal is quietly assuming a fill that never existed. Treat the gap as the first candle of the week, not as a data error.
- The dollar leg. XAU/USD moves are part gold, part dollar. A "gold strategy" can be an accidental short-dollar strategy — profitable for dollar reasons and defenceless when they reverse. Cross-check the signal against XAU/EUR: if the edge vanishes in euro terms, it was the dollar all along.
A workflow that holds up
Download daily first and prove the idea has a pulse over the full 1999-06-03-onward span. Only then buy resolution: intraday candles for timing, ticks if fills matter. Keep the final out-of-sample years untouched until the end. The tooling is format-agnostic — pandas, DuckDB/SQL, or MetaTrader — all fed from the same local downloads. If the idea generalises beyond gold, the other metals series run on the same session calendar, so the traps above transfer with it.
Frequently asked questions
- How much gold history is enough for a backtest?
- As much as the strategy's horizon needs to see several regimes. Daily-signal systems should use the full daily series (from 1999-06-03 here — the 2000s bull, 2011 top, 2013 crash, 2015 trough and since). Intraday systems are bounded by the intraday archive (from 2003-05-05).
- Should I backtest gold on ticks or candles?
- Candles, unless the strategy is spread- or fill-sensitive. Tick backtests are slower, the files are orders of magnitude larger, and for signal research the extra resolution changes nothing. Prototype on candles; confirm execution assumptions on ticks at the end.
- Why does my gold backtest disagree with the same strategy on another platform?
- The usual suspect is the daily cut-off: spot gold trades ~23 hours and platforms close their "day" at different times, so daily opens, closes and signals keyed to them legitimately differ. Compare cut-off conventions before suspecting the data.
- Does the licence limit how much gold history I can backtest?
- No — every tier reaches the full catalogue and the full history. Tiers differ by software features only (from €9, one-time). The limit that actually binds is the tick era's start date, which is a property of the archive, not the licence.
Related markets
- Forex Metals historical data · 18 instruments
Related guides
- Download Gold (XAU/USD) Price History
- Gold Tick Data (XAU/USD): What You Get, and How Big It Is
- Building the Gold–Silver Ratio from Historical Data
- How to Use MarketData Hub — The Complete Guide
- Historical Market Data CSV & JSON Format Explained
- Backtesting a Trading Strategy with Historical Data
- Download EUR/USD Price History
- How Far Back Does Historical Market Data Go?