Analyse Trading
Available on Google Play
Install

Backtesting a chart pattern: measure instead of believing

6 min readFreeAnalyse-Trading team
Key takeaways
  • 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.
Contents
  1. Step 1: write the rules before you test
  2. Step 2: a big enough sample
  3. Step 3: measure the right number
  4. The two biases that flatter your results
  5. From backtest to live account

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.

  1. Market and timeframe: for example EUR/USD on the 4-hour chart, from 2019 to 2024.
  2. Pattern definition: two lows within 15 pips of each other, at least 10 candles apart, after a decline of at least 150 pips.
  3. Entry signal: a candle closing above the intermediate high.
  4. Stop: 5 pips below the lower of the two lows.
  5. Exit: target at the projected height, or the stop, or exit after 30 candles if neither is hit.
  6. 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.

5,9787,1278,2769,425— 1% per trade— 5% per tradefalse
Even with a decent win rate, long losing streaks happen: on a small sample, they completely distort the result.

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.

Expectancy (in R) = (Win rate × Average win) − (Loss rate × Average loss)
Backtest of double bottoms on EUR/USD (4-hour chart)
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.

1:11:21:31:420 %40 %60 %ProfitableLosingR:R ratio → · win rate ↑
Expectancy combines win rate and reward-to-risk: a low win rate can still be profitable if the wins are big.

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.

BiasWhat it doesFix
Look-ahead biasUses the future to decideCandle-by-candle replay, written rules
Survivorship biasOnly tests the winnersFull universe, including what disappeared
Over-optimisationFits the rules to the pastTest on a period you haven't used
Forgotten costsResults too good to be trueSpread, 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 / 3
1. Why should you write your rules down before backtesting?
2. Win rate 40%, average win +2R, average loss −1R. What is the expectancy?
3. You test a pattern only on the stocks that make up the index today. Which bias are you falling into?

Educational content, not investment advice. Leveraged trading carries a high risk of losing money rapidly: most retail investor accounts lose money on these products.