Bullish and bearish candlestick patterns: do they hold up in tests?
Candlestick patterns can be backtested once each one is written as an exact numeric rule. On their own they are weak evidence, so test them with context filters, after costs and against a baseline of filtered non-pattern bars.
By Soren Huang · Published · updated · Editorial policy
Contents
- Do candlestick patterns hold up when you test them as rules?
- What are the common bullish and bearish candle patterns?
- How do you define a candlestick pattern with exact numbers?
- Which context filters make a pattern worth testing?
- How do you test a candle pattern after futures costs?
- Why is a candle pattern alone weak evidence?
- Frequently asked questions
- References
Do candlestick patterns hold up when you test them as rules?
Bullish and bearish candlestick patterns such as the engulfing, hammer, shooting star and doji can be backtested once each is written as an exact numeric rule. Alone, they are weak evidence: they use one or two bars of information and their definitions vary. Test them with trend and volatility filters, after futures costs, against a baseline of filtered non-pattern bars.
A candlestick is a way of drawing one price bar that shows its open, high, low and close. The body is the part between the open and the close. The shadows (also called wicks) are the thin lines above and below the body, reaching to the high and the low. The range is the distance from the low to the high.
A candlestick pattern (in Chinese, K線型態) is a shape made by one or a few candles that traders read as a sign of what price may do next. On Taiwan charts a rising candle is usually red and a falling candle green. US charts usually use the opposite colours. The rules in this article use open and close, so they work with either colour scheme.
What are the common bullish and bearish candle patterns?
Most pattern lists start with the same handful of reversal shapes. Each shape means something only after a move in the opposite direction. The table lists the common ones and where each is supposed to appear.
| Pattern | Candles | Usual reading | Where it should appear |
|---|---|---|---|
| Bullish engulfing | 2 | Bullish reversal | After a decline |
| Bearish engulfing | 2 | Bearish reversal | After a rise |
| Hammer | 1 | Bullish reversal | After a decline |
| Hanging man | 1 | Bearish (same shape as a hammer) | After a rise |
| Shooting star | 1 | Bearish reversal | After a rise |
| Inverted hammer | 1 | Bullish (same shape as a shooting star) | After a decline |
| Doji | 1 | Indecision | Anywhere; the meaning depends on context |
The hammer and the hanging man have the same shape. So do the shooting star and the inverted hammer. Only the move before the candle tells them apart. This is why a pattern test without a trend condition is testing a different idea from the one in the textbook.
How do you define a candlestick pattern with exact numbers?
A pattern becomes testable only when a computer can mark every candle as "pattern" or "not pattern" with no judgement. Words such as "small body" or "long shadow" must become numbers. One ratio does most of the work:
Body ratio = |C − O| ÷ (H − L)
Here C is the close, O is the open, H is the high and L is the low of the candle. The vertical bars mean "size, ignoring the sign". The ratio is near 0 when the body is tiny and near 1 when the body fills the whole range. The upper shadow is the high minus the higher of open and close. The lower shadow is the lower of open and close minus the low.
The thresholds below are a reasonable starting point. They are choices, not standards.
| Pattern | Example conditions |
|---|---|
| Bullish engulfing | Previous candle closes below its open. Current candle closes above its open. Current open is at or below the previous close. Current close is at or above the previous open. |
| Bearish engulfing | The mirror image: previous candle rises, current candle falls, and the current body covers the previous body. |
| Hammer | Body ratio at most 0.3. Lower shadow at least 2 times the body. Upper shadow at most 10% of the range. |
| Shooting star | Body ratio at most 0.3. Upper shadow at least 2 times the body. Lower shadow at most 10% of the range. |
| Doji | Body ratio at most 0.1. |
Two details matter on futures. First, on intraday bars of a liquid contract, the next bar usually opens at or very close to the previous close. A strict engulfing rule that requires the open to be below the previous close will then almost never trigger. Allowing "at or below" fixes this. Second, the same thresholds behave differently on 5-minute and daily bars, so define and test each time frame separately.
Which context filters make a pattern worth testing?
A pattern without context is mostly a random bar shape, so add the conditions the pattern is supposed to need. Trend, volatility, location and session are the four that matter most. Keep the list short, because each filter is one more choice that can be fitted to noise.
| Filter | Example rule for a bullish pattern | Why it helps |
|---|---|---|
| Prior trend | Close is below its 20-bar moving average | A reversal pattern needs something to reverse. |
| Volatility | Candle range is at least 1 times the 14-bar ATR | Removes tiny bars where one tick changes the shape. |
| Location | Candle low is the lowest low of the last 10 bars | Places the pattern at a short-term extreme. |
| Session | Test day-session and night-session bars separately | Night bars are often thinner, so shapes mean less. |
The ATR (Average True Range) is the average size of recent bars, including gaps between bars. It is useful here because it scales the pattern to current conditions. A 10-point hammer is large in a quiet market and meaningless in a fast one.
The volatility filter matters most for the doji. On a quiet overnight bar with a range of one or two ticks, almost every candle passes a "body ratio at most 0.1" rule. A minimum range removes those bars before they flood the results.
How do you test a candle pattern after futures costs?
Test the pattern the way you would trade it, and compare it with a baseline instead of with zero. A baseline is the same trade taken on bars that pass the same filters but are not patterns. If the pattern does not beat its baseline before costs, the shape adds no information.
- Fix the definition and filters from the tables above, and do not change them during the first test.
- Enter on the next bar's open. The pattern is only complete at the close of its last candle, so filling on that same close uses a price you could not trade at.
- Use a simple exit first, such as a fixed holding period of a few bars. This measures what happens after the pattern before a stop or target adds its own effect.
- Subtract round-trip costs: commission, exchange fees and taxes, and slippage on both entry and exit. See trading costs in backtests for how to estimate each one.
- Run the baseline with the same entry, exit, filters and costs, without the pattern condition.
- Split the results: long and short separately, day and night session separately, and earlier and later years separately.
- Move each threshold a little, for example a shadow of 1.5, 2 or 2.5 times the body. A real effect stays similar when the numbers move slightly.
Hypothetical example
A trader tests a filtered bullish engulfing on 5-minute Mini-TAIEX bars, where one index point is worth NT$50. The rule finds 300 signals. Holding for 6 bars, the average gross move after a signal is +4 points. Long trades on all filtered bars, without the pattern, average +2 points. So the pattern adds about 2 points over the baseline.
The trader assumes round-trip costs of 3 points: about 1 point of commission and tax, plus 1 point of slippage on each side. The pattern trades then net +1 point, or NT$50 per trade and NT$15,000 over 300 trades. With slippage doubled, costs become 5 points and the pattern nets −1 point per trade. The edge exists in this example, but it is thinner than one extra point of slippage per side.
This fixed structure of rules, parameter ranges and entry and exit conditions is what strategy generation in AlphaPrime (Valynox) is built around. Each research idea becomes a rule that can be tested the same way every time.
Why is a candle pattern alone weak evidence?
A pattern alone is weak evidence because it carries little information, and because the number of ways to define it is large. Each reason pushes the best-looking test result above what you can expect later.
- Little information. One or two candles describe a few minutes or a few days of trading. A trend, a volatility regime or a session effect usually explains more of the next move.
- Many free choices. Shadow multiples, body ratios, trend lengths, ATR settings and holding periods together give hundreds of combinations. Testing all of them and keeping the best is a search, even if it does not feel like one.
- Few clean signals. After you add filters, a pattern may trigger only a few dozen times per market and time frame. A small sample makes a lucky result easy to find.
- Thin edge per trade. A pattern that predicts a small move must pay full round-trip costs on every signal, and intraday futures moves are small relative to those costs.
Research on trading rules shows the size of the search problem. Sullivan, Timmermann and White (1999) showed that when many technical rules are tried on the same price history, the best one can look strong by chance alone. They adjusted for this with White's Reality Check, a bootstrap method that accounts for how many rules were tried (White, 2000). Bailey and co-authors (2014) showed that the more variants a researcher tries, the more likely it is that the best backtest is overfitted. The guide to overfitting in strategy generation covers how to keep a search honest.
The practical answer is to test out of sample. Walk-forward analysis chooses the thresholds on one period and tests them on the next one, repeated across the history. Strategy validation in AlphaPrime runs walk-forward analysis with custom thresholds, so a pattern rule faces the same standard as any other rule.
What this means if you use AlphaPrime: write the pattern, its filters and its exits as fixed rules with realistic costs and next-bar execution, then let validation on unseen data decide whether the pattern stays in the strategy.
Frequently asked questions
What is the most reliable bullish candlestick pattern?
No candlestick pattern has a fixed reliability. Results depend on the exact definition, the market, the time frame, the filters and the trading costs. The useful question is whether your definition beats a baseline of non-pattern bars on your own market, after costs and out of sample.
How do you define a bullish engulfing pattern for a backtest?
The previous candle closes below its open, and the current candle closes above its open. The current open is at or below the previous close, and the current close is at or above the previous open. Add a prior-decline condition, such as a close below a 20-bar moving average, so the pattern appears where it is supposed to.
Do candlestick patterns work on intraday futures charts?
They can be tested on intraday futures bars, but the definitions need adjusting. Gaps between intraday bars are rare, so engulfing rules must allow the open to equal the previous close. Small bars should be removed with a minimum range, and costs take a larger share of each small move than on daily bars.
How many trades do you need to test a candlestick pattern?
There is no exact number, but a few dozen trades is a thin sample for any conclusion. Many traders want at least 30 to 50 trades in each test window, in-sample and out-of-sample. If filters reduce the pattern to fewer signals, test it on more history or more markets before trusting it.
What does K線型態 mean?
K線型態 is the Chinese term for candlestick patterns, such as engulfing, hammer, shooting star and doji. On Taiwan charts a rising candle is usually red and a falling candle green. Rules written with open and close work the same way regardless of the colours.
References
- Bailey, D. H., Borwein, J., López de Prado, M., & Zhu, Q. J. (2014). Pseudo-Mathematics and Financial Charlatanism: The Effects of Backtest Overfitting on Out-of-Sample Performance. Notices of the American Mathematical Society, 61(5), 458–471.
- Sullivan, R., Timmermann, A., & White, H. (1999). Data-Snooping, Technical Trading Rule Performance, and the Bootstrap. The Journal of Finance, 54(5), 1647–1691.
- White, H. (2000). A Reality Check for Data Snooping. Econometrica, 68(5), 1097–1126.
What AlphaPrime does here
Strategy generation turns research ideas into testable rules with entry and exit conditions and parameter ranges. AlphaPrime's backtesting evaluates them in batches with fees and slippage, next-bar execution and trading sessions included.

