How to backtest a gold strategy honestly
Every strategy looks great in a lucky test. The real question is whether the result repeats. This article shows how to fool yourself less when testing.
A result from 30 trades can miss the true win rate by about ±18 percentage points, and from 300 trades by about ±6. So do not judge a strategy on a small number of trades, include spread, and test on data you did not use for tuning.
Why short results deceive us
Luck plays a big role with few trades. Ten winners in a row can come from an ordinary strategy.
How many trades do you need?
The margin of error on a win rate shrinks as the number of trades grows. The figures are approximate (95% confidence) for a win rate near 50%.
The table
The table shows the margin for win rates of 50% and 40%:
| Trades | Margin (50% win rate) | Margin (40% win rate) |
|---|---|---|
| 30 | ±17.9% | ±17.5% |
| 100 | ±9.8% | ±9.6% |
| 300 | ±5.7% | ±5.5% |
| 1,000 | ±3.1% | ±3.0% |
Overfitting
If you keep changing settings (like an indicator period) until the past data looks best, you are memorising the past, not discovering a rule. The result usually gets worse on new data.
Common mistakes
Using information from the future by accident (like a candle close before it closes), ignoring spread and slippage, choosing one convenient test period, and forgetting that your broker may fill at a different price.
A better method
Split your data: one part for tuning and one you have not seen for testing. Then run the strategy on a demo account in real time and log results in R with the actual spread.
What about our signals?
The C1b strategy is still being tested, and site figures come from a public data feed without spread. Do not treat them as evidence of future profits, and try them on a demo account first.