Backtesting a chart pattern: measure instead of believing
- A pattern is only worth what its test shows: write the rules down before you look at the results.
- A handful of trades proves nothing; you need a sample of several dozen occurrences, ideally more.
- Look-ahead bias and survivorship bias make a pattern look better than it really is.
Throughout this level, you've learned to recognise patterns: head and shoulders, triangles, channels, breakouts, gaps, structure. Every time, the same line came back: a pattern is a probability, not a certainty. But what probability, exactly? On which market, which timeframe, with what stop? Nobody can answer that for you. The only way to find out is to test the pattern on historical data: the backtest.
Step 1: write the rules before you test
A backtest is worthless if the rules are vague. "I buy double bottoms that look clean to me" isn't a rule: your eye will unconsciously pick the examples that worked. You need to write down every decision precisely enough that someone else, using your rules, would take exactly the same trades as you.
- Market and timeframe: for example EUR/USD on the 4-hour chart, from 2019 to 2024.
- Pattern definition: two lows within 15 pips of each other, at least 10 candles apart, after a decline of at least 150 pips.
- Entry signal: a candle closing above the intermediate high.
- Stop: 5 pips below the lower of the two lows.
- Exit: target at the projected height, or the stop, or exit after 30 candles if neither is hit.
- Costs: realistic spread and commission deducted from every trade.
Step 2: a big enough sample
Ten trades prove nothing. With so few, luck dominates: a pattern with no edge at all can string together seven wins out of ten, and a very good pattern can lose five in a row. The bigger the sample, the closer the measured win rate gets to reality. Aim for at least a few dozen occurrences, ideally more than a hundred, spread across different market conditions: trending, ranging, high and low volatility.
If your pattern only shows up three times a year on your market, widen the net: more pairs, more timeframes, a longer period. But stay consistent: don't lump together markets that behave very differently without checking the results separately.
Step 3: measure the right number
The win rate alone isn't enough. A pattern that wins 70% of the time but loses three times as much when it fails is a losing pattern. What matters is expectancy: what a trade makes on average, once wins and losses are weighted by how often they happen.
- Patterns found and traded according to the rules
- 60
- Winning trades
- 33 (55% win rate)
- Losing trades
- 27 (45% loss rate)
- Average win
- +1.5R
- Average loss
- −1R
- Calculation: (0.55 × 1.5) − (0.45 × 1)
- 0.825 − 0.45
- Expectancy per trade
- +0.375R
Illustrative figures. With 60 trades, the result is still fragile: a handful of different trades would be enough to change it significantly.
Also look at the test's worst losing streak and maximum drawdown. A pattern with positive expectancy that puts you through ten losses in a row may not suit you psychologically, or may call for a lower risk per trade.
The two biases that flatter your results
Look-ahead bias means using information you didn't have at the time of the trade. On a past chart, you can see that the right shoulder was the last one, that the breakout held, that the gap never filled. In real time, you didn't know that. To avoid it, step through the chart candle by candle with the future hidden, and decide using only what's visible on the left.
Survivorship bias means only testing what survived. If you test a pattern on the stocks in today's S&P 500, you forget all the ones that dropped out after a collapse. If you pick the pairs that trended best in recent years, you've chosen the result in advance. It also affects the results you see online: people post screenshots of patterns that worked, rarely the others.
| Bias | What it does | Fix |
|---|---|---|
| Look-ahead bias | Uses the future to decide | Candle-by-candle replay, written rules |
| Survivorship bias | Only tests the winners | Full universe, including what disappeared |
| Over-optimisation | Fits the rules to the past | Test on a period you haven't used |
| Forgotten costs | Results too good to be true | Spread, commission and swap deducted |
From backtest to live account
A good backtest is only a first step. Markets change, and real execution (slippage, emotions, missed trades) always drags results down a little. The next step is to trade the pattern on a demo account or at a very small size, and compare your live statistics with the test. If the gap is large, find out why before you increase your risk.
To judge other traders by the same standard, always favour results measured on a real account over a long period rather than a string of screenshots. On Analyse-Trading, track records are calculated directly from the connected broker account, winning and losing trades included.
Check your understanding
0 / 3Educational content, not investment advice. Leveraged trading carries a high risk of losing money rapidly: most retail investor accounts lose money on these products.