Do Candlestick Patterns Actually Work? How to Backtest Them

Candlestick patterns are widely used, but whether they work depends on the market, timeframe, rules and risk management. This guide explains how to answer that question for yourself: turning a pattern into objective rules, collecting data, running manual and coded backtests, measuring win rate, average R and expectancy, avoiding look-ahead bias and overfitting, and forward testing before risking.

Mirza BilalUpdated 10 min read
Do Candlestick Patterns Actually Work? How to Backtest Them

Do Candlestick Patterns Actually Work? How to Backtest Them

Learn how to test candlestick patterns properly, measure the results that matter, and avoid the mistakes that make backtests look better than real trading.

Written by Mirza Bilal, trader and trading education content creator at Its Boring Business

After learning more than twenty candlestick patterns, one question matters more than any other: do they actually work?

The honest answer is that it depends. A pattern is not a strategy. Whether a hammer, engulfing or morning star helps you make money depends on the market, the timeframe, where it forms, how you enter, where you place your stop, how you exit and what it costs you to trade.

The only reliable way to answer the question for your own trading is to test it.

In this guide you will learn how to turn a pattern into objective rules, how to backtest it manually or with code, which results to measure, how to avoid the biases that make backtests misleading, and how to move from a backtest to real trading safely.

This is the final guide in the Its Boring Business candlestick series. You can see every pattern on one page in Candlestick Patterns Cheat Sheet: All Patterns on One Page.

Its Boring Business

Why "Does This Pattern Work?" Is the Wrong Question

A pattern on its own does not make or lose money. A trade does. And every trade has several parts:

Part of the trade

Question

Signal

Which pattern, and how exactly is it defined?

Context

Which market, timeframe, trend and location?

Entry

Where and when do you get in?

Stop-loss

Where is the idea wrong?

Exit

Where do you take profit?

Costs

What do fees, spreads and slippage take?

The same hammer can be part of a losing system with one set of rules and a profitable one with another. That is why the better question is: does this specific set of rules have a positive expectancy in this market, after costs?

Step 1: Turn the Pattern into Objective Rules

Step 1: Turn the Pattern into Objective Rules

You cannot test a feeling. "Buy a strong hammer at support" means different things to different people, and even to the same person on different days.

Every part of the rule must be specific enough that two people would mark exactly the same trades.

Vague rule

Testable rule

A hammer

Lower wick at least 2× the body, upper wick no more than 10% of the range

At support

Low falls inside a zone marked before the candle formed

After a downtrend

Close below the 50-period moving average

Enter on confirmation

Enter at the next candle's open if it opens above the hammer's close

Stop below the low

Stop 0.5% below the hammer's low

Take profit

Exit at 2R, or after 20 candles if neither stop nor target is hit

Write these rules down before you look at any results. Changing them after seeing the outcome is one of the fastest ways to fool yourself.

Step 2: Choose the Market, Timeframe and Period

Decide in advance:

  • Which market: for example BTCUSDT on one exchange, or EURUSD from one broker
  • Which timeframe: for example 4-hour
  • Which period: for example three years of data

Test on the same data you would actually trade. Results on one exchange or broker may differ from another because prices, spreads and liquidity differ.

A useful habit is to split the data into two parts before testing:

  • In-sample: the older part, used to build and adjust the rules
  • Out-of-sample: the newer part, kept untouched until the rules are final

Step 3: Collect Enough Trades

A small sample tells you very little. Ten trades can easily show a 70% win rate by luck alone.

There is no magic number, but many traders aim for at least 100 trades before drawing conclusions, and more is better. If a pattern only produces a handful of signals per year on your chosen market, you may need a longer period or several markets.

Step 4: Backtest Manually or with Code

Step 4: Backtest Manually or with Code

Manual backtesting

You scroll through historical charts candle by candle and record every signal that meets your rules.

Advantages: you learn how the pattern really looks, and it costs nothing but time.

Risks: it is slow, and it is very easy to unconsciously skip bad trades or see setups that are not really there.

Tips for honest manual backtesting:

  • Hide future candles. Most charting platforms have a replay mode that reveals one candle at a time.
  • Record every valid signal, including the ones you would have "felt" bad about.
  • Mark levels before you scroll forward, never after.

Coded backtesting

You write the rules as code and let a program find every signal.

Advantages: fast, consistent, and able to test thousands of trades.

Risks: coding errors, and the temptation to test hundreds of variations until one looks good.

Common tools include TradingView's Pine Script, Python with historical price data, and dedicated backtesting platforms. Here is a simple example of how a bullish engulfing rule might be written in Python-style logic:

# Bullish engulfing on candle i (uses only completed candles)
prev_red   = close[i-1] < open[i-1]
curr_green = close[i]   > open[i]
engulfs    = open[i] <= close[i-1] and close[i] >= open[i-1]

if prev_red and curr_green and engulfs:
    entry = open[i+1]          # enter on the NEXT candle's open
    stop  = min(low[i-1], low[i]) * 0.995
    risk  = entry - stop
    target = entry + 2 * risk  # 2R target

Notice that the entry uses the next candle's open. Entering at the close of the signal candle assumes you could act at that exact price, which is not always realistic.

Step 5: Measure the Right Results

Step 5: Measure the Right Results

Record every trade, then calculate these figures:

Metric

What it tells you

Number of trades

Whether the sample is large enough

Win rate

How often trades win

Average win (in R)

How big winners are, relative to risk

Average loss (in R)

How big losers are, usually close to 1R

Expectancy

The average result per trade

Maximum drawdown

The largest drop from a peak

Longest losing streak

What you must be able to sit through

Results after costs

Whether fees and slippage destroy the edge

What is R?

R is the amount you risk on a trade. If your stop is $5 away and you trade one unit, 1R is $5. A trade that makes $10 is +2R. A trade that loses $5 is −1R.

Measuring in R lets you compare trades and strategies fairly, regardless of price or position size.

Expectancy: the most important number

Expectancy: the most important number

Expectancy tells you what you can expect to make or lose per trade, on average:

Expectancy = (Win rate × Average win) − (Loss rate × Average loss)

Hypothetical example:

Figure

Value

Trades

100

Win rate

40%

Average win

2R

Loss rate

60%

Average loss

1R

Expectancy

(0.40 × 2) − (0.60 × 1) = +0.2R per trade

This strategy loses more often than it wins, yet it has a positive expectancy. Over 100 trades, it would make about 20R before costs.

Now compare a strategy with a 70% win rate, an average win of 0.5R and an average loss of 1.5R:

(0.70 × 0.5) − (0.30 × 1.5) = 0.35 − 0.45 = −0.1R per trade.

It wins far more often, but it loses money over time. Win rate on its own tells you very little.

Include realistic costs

Subtract fees, spreads, funding rates (for perpetual futures) and slippage from every trade. A strategy with an expectancy of +0.1R before costs can easily become negative after them, especially on low timeframes with frequent trades.

Step 6: Avoid the Biases That Make Backtests Lie

Step 6: Avoid the Biases That Make Backtests Lie

Bias

What it is

How to avoid it

Look-ahead bias

Using information that was not available at the time

Only use completed candles; enter on the next candle

Overfitting

Tuning rules until they fit past data perfectly

Keep rules simple; test on out-of-sample data

Small sample

Drawing conclusions from too few trades

Aim for at least 100 trades

Cherry-picking

Skipping trades that "look wrong"

Record every signal that meets the rules

Ignoring costs

Leaving out fees, spreads and slippage

Subtract realistic costs from every trade

Unrealistic fills

Assuming entries at prices you could not get

Use next-candle opens or limit fills you could realistically get

Two specific warnings from this series:

  • Support and resistance drawn after the fact creates look-ahead bias. Mark zones using only the data available before the signal.
  • Heikin Ashi prices are not real. If you test Heikin Ashi signals, use real prices for entries and exits. See Heikin Ashi vs Japanese Candlesticks.

Beware the perfect backtest

Beware the perfect backtest

If a backtest shows an almost perfectly smooth equity curve, be suspicious. Real trading includes losing streaks and drawdowns. A curve that never dips often means the rules were tuned to fit the past.

The test that matters is the out-of-sample data. If results collapse on data the rules have never seen, the strategy was overfit.

Step 7: Forward Test Before Risking Real Money

A backtest tells you how rules would have performed. A forward test tells you how they perform now, and how you perform with them.

A sensible progression:

  1. Backtest on in-sample data.
  2. Validate on out-of-sample data.
  3. Paper trade or demo trade in real time for a meaningful number of trades.
  4. Trade small with real money, using the same rules.
  5. Compare live results with backtest results regularly.

If live results differ a lot from the backtest, find out why before increasing size. Common reasons are execution, costs, or not following the rules.

Chart Patterns Book by Mirza Bilal

So, Do Candlestick Patterns Work?

Here is a balanced view.

What tends to help:

  • Patterns combined with trend, location and confirmation
  • Clear stops and targets with a positive risk-to-reward
  • Higher timeframes, where noise is lower
  • Consistent position sizing

What tends to hurt:

  • Trading patterns alone, anywhere on the chart
  • Very low timeframes with high costs
  • Vague rules that change from trade to trade
  • Ignoring drawdowns and losing streaks

No candlestick pattern is a guaranteed edge. Results vary by market, timeframe and period, and an edge that worked in the past can weaken. What testing gives you is not certainty, but evidence, and a clear understanding of what to expect.

Frequently Asked Questions

1. Do candlestick patterns actually work?

It depends on the rules, market, timeframe and risk management. A pattern is only one part of a strategy. Testing is the only way to know for your own trading.

2. What is backtesting?

Testing a set of trading rules on historical data to see how they would have performed.

3. How many trades do I need in a backtest?

There is no fixed number, but many traders aim for at least 100 trades before drawing conclusions.

4. What is expectancy in trading?

The average result per trade: (win rate × average win) minus (loss rate × average loss).

5. Is a high win rate good?

Not on its own. A low win rate can be profitable with large winners, and a high win rate can lose money with large losers.

6. What is R in trading?

R is the amount risked on a trade. Results are measured as multiples of R, such as +2R or −1R.

7. What is overfitting?

Adjusting rules until they match past data too closely, so they fail on new data.

8. What is look-ahead bias?

Using information in a backtest that would not have been available at the time of the trade.

9. Should I backtest manually or with code?

Both are useful. Manual testing builds understanding. Coded testing is faster and more consistent.

10. Can I backtest on TradingView?

Yes. TradingView supports manual replay and coded strategies with Pine Script.

11. What is forward testing?

Testing rules in real time, on demo or with small size, after a backtest, to see if results hold.

12. Do I need to include fees in a backtest?

Yes. Fees, spreads, funding and slippage can turn a profitable backtest into a losing strategy.

Conclusion: Test It Before You Trust It

Candlestick patterns are a useful way to read price. But reading price and making money are not the same thing.

The difference is a tested plan: objective rules, realistic costs, enough trades, honest records and a forward test before real risk. That process turns "I think this works" into "I know how this has behaved, and what to expect."

That is the right way to end this series. Learn the patterns. Understand the context. Then test everything.

At Its Boring Business, Mirza Bilal shares practical trading education to help readers understand price action and build a structured, risk-aware approach to the markets.

Start the series from the beginning: Basic Candlesticks Explained: A Complete Beginner's Guide

Also read: Candlestick Patterns Cheat Sheet: All Patterns on One Page

Explore more trading guides at itsboringbusiness.com.

Define it. Test it. Then trade it.

Education, not financial advice. Trading involves substantial risk of loss. Examples are for learning only — always do your own research and manage your risk.
Mirza BilalCEO & Founder · Its Boring Business

Full-time trader with over five years in crypto spot, forex and futures. He writes about risk, discipline and the boring habits that keep an account alive.

Keep reading.

All articles

Liked this one?
Get the next on Monday.

Levels, setups and lessons in a 2-minute read. No spam — unsubscribe anytime.