Gold Lab · free tool

Strategy Lab: backtest a gold idea

Test a trading rule on real gold prices in your browser: moving averages, RSI, breakouts or session opening ranges, with ATR stops, costs and risk. See the equity curve and how fragile the result is.

A game for learning, not a signal. Nothing here predicts prices or tells you to buy or sell. Past prices do not predict future prices.

Test a gold trading idea in 30 seconds

Strategy Lab runs a simple trading rule over real gold prices in your browser and shows what would have happened, with costs, an ATR stop and a target. Choose daily bars since 2015 or hourly bars since mid-2024, pick one of four rule templates, set the parameters and press Run. You get the equity curve, the trade count, win rate, expectancy in R, profit factor, maximum drawdown and the worst losing streak.

How the test works

  • Signals are read at the close of a bar; the trade opens at the next bar's open. Only one position at a time.
  • Stop and target are set in multiples of the 14-bar average true range (ATR) at entry. They fill from each bar's real high and low; if one bar touches both, the stop is counted first. A bar that opens beyond a level fills at its open. With target 0, a trade exits on the opposite signal (or its stop).
  • Costs: the cost per ounce you enter (spread plus fees) is subtracted from every trade. Swaps are not included.
  • R: each trade's result divided by the dollar distance to its stop. The equity curve compounds your risk per trade on the account.
  • Session opening-range breakout (hourly only): the high and low of the first one to three hours after the London (07:00 UTC) or New York (13:00 UTC) open; the first close outside opens a trade; anything still open is closed at 21:00 UTC.

Why the parameter sweep matters

Any rule can look good with the right settings on one stretch of history. That is curve-fitting. The sweep re-runs the test across a grid of nearby settings and colours each cell by expectancy. If the result only works in one cell and its neighbours lose, it is probably luck. A robust idea shows a broad area of similar results. The lab also warns when a test has fewer than 30 trades, because small samples say almost nothing.

Our own long-form tests of 14 popular strategies are on gold strategies tested on real data; the method behind them is in how to backtest a gold strategy. Turn a promising result into position sizes with the position size calculator, and practise executing it on the practice simulator.

Data and limits

Prices are COMEX gold futures (GC=F) via Yahoo Finance: daily bars since 2015 and hourly bars since June 2024, the same data used across this site. Futures differ slightly from spot XAUUSD. Backtests leave out slippage, swaps, partial fills and the psychology of real money. Past results do not predict future results; this is an education tool, not a signal service.

Frequently asked questions

Is this backtester free?

Yes. It runs entirely in your browser on the price data this site already publishes. No account and nothing is uploaded.

What data does the Strategy Lab use?

COMEX gold futures (GC=F) bars via Yahoo Finance: daily bars since 2015 and hourly bars since June 2024. Futures prices are a few dollars above spot XAUUSD, which does not change the shape of the results much.

What does expectancy in R mean?

The average result per trade measured in units of the risk taken (the distance to the stop). +0.2R means that on average each trade made 20% of what it risked, after the costs you entered.

Why does a good-looking result get a warning?

Because small samples and settings that only work in one spot of the parameter sweep are the classic signs of curve-fitting. A result needs many trades and similar results for nearby settings before it means anything.

Are spreads and swaps included?

The cost per trade you enter is subtracted from every trade. Overnight swaps and slippage are not modelled, so real results are usually worse.

Can I use these results to trade?

Use them to learn which ideas are worth deeper study, not as signals. Past performance does not predict future results.

More in the Gold Lab

All games and your scores

Educational game only. Not financial advice and not a signal. Prices are COMEX gold futures (GC=F), which differ slightly from spot XAUUSD. See our risk disclaimer.