A backtest is the cheapest lesson in trading: it lets years of market history mark your homework before any money is at risk. It is also the easiest tool in trading to lie to yourself with. The difference between the two outcomes is method. This guide covers the five ways backtests lie, then a step-by-step process for producing a result you can actually trust, with gold (XAU/USD) as the working example throughout.
The five ways backtests lie
1. Overfitting: the flattering curve
Give any strategy enough adjustable parameters and it will fit the past perfectly, because you are no longer modelling the market, you are memorising it. The classic tell is a strategy that needed exactly these session times, exactly this stop distance and exactly that indicator length to work. Each parameter you tune to improve a historical result borrows performance from the future. Fewer rules, tested over more data, beats intricate rules tuned to one good year.
2. Ignoring spread and costs
Gold's spread is not a rounding error. It widens dramatically around news, at session opens and in the overnight lull, exactly the moments breakout strategies trade. A strategy that scalps 20 points per winner and ignores a 3 to 5 point spread is overstating its edge by a quarter before slippage. Test with realistic costs or the arithmetic is fiction.
3. Session and time-of-day blindness
XAU/USD has a pronounced daily rhythm: a quiet Asian session that builds a range, a burst of volatility and direction at the London open, and a second wave at the New York open. A backtest that samples all hours equally can hide the fact that all of the edge lives in two hours of the day, or worse, that all of the losses do. Always break results down by session and hour. If the edge concentrates somewhere, you want to know; if the edge disappears when you exclude one freak day, you really want to know.
4. The cherry-picked window
Any strategy looks brilliant tested only on the regime it suits. Gold since 2020 has produced strong trending years and vicious chop, sometimes in the same quarter. A trustworthy test spans multiple years and multiple regimes: trend, range, high and low volatility. If a strategy only worked in one regime, that is not a failure of the test, it is the most useful thing the test can tell you, provided you know which regime you are in before you trade it.
5. Intrabar make-believe
The subtlest lie: within a single candle, did price hit your stop or your target first? A naive backtester assumes whichever is convenient. On a volatile instrument like gold, where a single M15 candle can span both your stop and your target, this single assumption can flip a losing strategy to a winning one on paper. The engine you test with should evaluate on candle-by-candle data fine enough to resolve the order of events, and should tell you when it cannot.
A process you can trust
Step 1: write rules a machine could follow
"Buy when it breaks out with momentum" is not a strategy, it is a mood. A testable rule set specifies the setup, the trigger, the entry, the stop, the target and the exit conditions with no judgement calls left over. A useful test of your own rules: could someone else, given only the written rules and the same chart, take exactly the same trades? If not, tighten the rules before testing, because whatever you test will not be what you end up trading.
Step 2: test years, on real candles, with costs on
Run the rules over multiple years of real price data with spread applied. Do not stop at the headline profit figure. The numbers that matter, in order: maximum drawdown (would you have survived it, financially and psychologically?), longest losing streak (will you still follow rule ten after nine losses?), profit factor (gross wins over gross losses, where anything close to 1.0 means the edge may be noise), and trade count (fifty trades is an anecdote; several hundred begin to mean something).
Step 3: interrogate the distribution, not the average
Break the results down by year, by session, by day of week. A strategy that made everything in three months of 2023 and trod water otherwise is a different proposition from one that ground out steady results across the whole test. Neither is disqualified, but you should know which one you own before real money meets it.
Step 4: forward test before you commit
The final exam is running the exact tested rules on live prices with paper money for weeks. This catches everything the backtest could not: current spread behaviour, execution timing and the small honest gaps between historical assumption and live reality. We cover why this step catches problems backtests structurally cannot in forward testing vs backtesting.
The honest summary
A good backtest cannot promise the future. What it can do is falsify bad ideas cheaply and give surviving ideas a track record you can size against, which is precisely what you need if the destination is a prop firm evaluation with hard drawdown limits (see how to pass an FTMO evaluation). Treat every flattering result as a suspect, hunt for the lie in it, and only trade the strategies where you fail to find one. If you would rather not build the testing infrastructure yourself, this is exactly what Forge Strategy Lab does: rule-based strategies built visually, tested over years of real gold candles with the drawdown shown first, no code required.
This guide is education, not financial advice. Trading involves risk and past performance, tested or live, never guarantees future results. Make your own decisions and never risk money you cannot afford to lose.