Backtesting checks how a strategy would have performed on past data, to see if it has an edge before you risk real money. Write objective rules a stranger could follow, test a large sample across different conditions, and measure the result as expectancy in R. The great danger is overfitting. The real proof is forward testing.
Why backtest at all
Trading an untested strategy is gambling with extra steps. You have no idea whether it has an edge. Backtesting lets you estimate that edge cheaply, on history, before a cent is at risk. It answers one question: over many trades, does this make money?
It also builds the confidence to follow a plan through a losing streak, because you have seen the strategy survive drawdowns before.
Define objective rules
A strategy you can backtest must be mechanical enough to be unambiguous: exact entry conditions, a defined stop and a defined target or exit. If two people reading your rules would take different trades, the rules are too vague to test.
Writing rules this precisely forces you to turn a vague idea, such as buy the dip, into something you can execute and measure.
Gather a large sample
A handful of trades proves nothing, because luck dominates. Aim for at least 100 trades, more if you can, spanning trends, ranges, and high and low volatility. A strategy that only worked in one 2020-style trend is not a strategy.
Record each trade's result in R, then compute the expectancy and the worst drawdown. Those two numbers tell you whether the edge is real and whether you could survive trading it.
The trap: overfitting
Overfitting is adding rules and tweaking parameters until the strategy looks flawless on past data. A curve fit perfectly to history describes the past, not the future, and falls apart when conditions change.
Guard against it with simplicity. Fewer rules and round, un-tuned parameters generalise better. If a setting looks magical, be suspicious.
Overfitting in numbers
In our testing, a 10-day momentum rule scored 60.2% on the period it was fitted to and 42.1% on unseen days. Price above its 20-day average went from 59.6% to 43.0%. Six of the 16 rules tested were flagged.
We also caught a look-ahead bug that manufactured an 11-percentage-point edge. It fell to about 2 once the signal was stamped at the confirming bar. See what we learned testing gold methods for the results.
Forward test before you scale
Forward testing means running the strategy on new data it has never seen, on a demo account or with micro lots. It is the only test that cannot be gamed, because you cannot fit to data that has not happened yet.
Backtest to find a candidate edge, forward test to confirm it, then scale slowly. Past results are evidence, never a promise.
Questions
What should I measure when backtesting?
Record each trade in R-multiples, then calculate the strategy's expectancy and its worst drawdown. They show whether the edge is positive and whether you could survive trading it.
How many trades do I need to backtest?
At least 100, ideally more, across different market conditions. A small sample is dominated by luck and cannot confirm an edge.
Is backtesting enough to trust a strategy?
No. Overfitting can game it. The real proof is forward testing on new data, on demo or with micro lots, before scaling up.
70–80% of retail investor accounts lose money trading CFDs. This page is education, not advice. All trade examples are constructed composites.
