How to backtest a chart pattern strategy (and quantify its edge)
A backtest answers one question: if I had followed these exact rules in the past, what would have happened? It's the closest thing traders have to evidence. It's also easy to get wrong. Here is how we approach it at Pattern Proof, so you can test your own ideas.
Step 1: Turn the pattern into rules a computer could follow
Every part has to be precise:
- Setup: what has to be true before the pattern counts (for example, "price above a rising 200-day average").
- Trigger: the exact event that opens the trade ("daily close above the cup rim").
- Stop: where the trade is wrong ("below the handle's low").
- Exit: a target, a trailing stop, a time limit or an opposite signal.
If any part needs judgment ("looks like a good handle"), you'll end up testing your mood rather than the pattern.
Step 2: Choose the data
- Enough history: several years, covering different market conditions. We use 5 years of daily bars.
- Enough stocks: one stock tells you about that stock. We use 136 large, liquid US stocks.
- Clean, adjusted prices: splits and dividends handled.
Step 3: Run the rules bar by bar, without peeking
The most common backtest bug is look-ahead bias: using information that wasn't available yet, like entering at a day's close based on that same day's high that hadn't happened at the moment of decision, or knowing which stocks would still exist years later. Process each day in order and only use data up to that day.
Step 4: Measure the right things
| Metric | What it tells you |
|---|---|
| Number of trades | How much to trust everything else. Be wary below about 200. |
| Win rate | How often trades made money. Meaningless on its own. |
| Average R | Average result per trade in units of risk: the core measure of edge. |
| Profit factor | Gross gains ÷ gross losses. Above 1.0 means gains outweighed losses. |
| Average hold | How long your money is tied up, and how much overnight risk you carry. |
| Worst losing streak | What you'll have to sit through emotionally. |
Quantifying the edge: average R is your expectancy. If a pattern averages +0.10R and you risk $100 per trade, you'd expect roughly +$10 per trade over many trades, before costs. Multiply by trades per year to see whether it's worth the effort.
Step 5: Compare against a baseline
A pattern that "wins" 45% of the time might be doing no better than random entries in a rising market. Compare your results against simple alternatives, such as entering on random days with the same stop and exit, or just holding the stocks. An edge only counts if it beats doing nothing special.
Step 6: Check it isn't luck or overfitting
- Don't tune too much. If you try 50 versions and keep the best, you've probably found noise. This is called data snooping.
- Hold some data back. Build the rules on one period, then test them unchanged on another.
- Look at subgroups. Does it work on most stocks and in most years, or did a few big winners carry it?
Step 7: Add costs and realism
Commissions, the bid-ask spread and slippage all reduce results, and they hurt short-term patterns most. Our published numbers exclude them, so treat any edge under about +0.05R as fragile.
The known limitations of our own numbers
We're upfront about these: Pattern Proof's backtests use end-of-day data, exclude costs, and run on today's large-cap stocks, so they carry survivorship bias (companies that collapsed or were removed from the list aren't included). That tends to flatter long setups.
Don't want to build it yourself? Pattern Proof publishes these metrics for 29 patterns, and each setup within them. Browse the patterns.
Educational research, not financial advice.