Explainers / Candlestick Patterns Identified by repo3
Candlestick Patterns Identified by repo32, explained from the source
Candlestick Patterns Identified is an open-source TradingView indicator by repo32, first published in 2015 and updated to Pine version 6 in January 2026, with about 35,100 boosts. It marks 15 candlestick patterns on the chart with labels and gives each one an alert. This page walks through the published code, says what each rule really checks, and ends with where it fails. It does not say whether any pattern makes money, and it gives no trades.
Step 1: the two settings
There are two settings that change what is found, plus six colour settings.
- Trend in Bars (5). Most patterns compare this bar's open with the open 5 bars back. A bearish pattern needs the open to be higher than it was 5 bars ago; a bullish one needs it lower. That one comparison is the whole trend filter.
- Doji size (0.05). A bar is a doji when its body is at most 5% of its full range.
Step 2: what each pattern checks
| Pattern | What the code asks for | Trend check |
|---|---|---|
| Doji | body at most 5% of the range | none |
| Bullish / Bearish Harami | this body sits inside the previous body and is smaller, opposite colour | yes |
| Bullish / Bearish Engulfing | this body covers the previous body and is larger, opposite colour | yes |
| Piercing Line | after a down bar, opens below the previous low and closes past the middle of the previous body | yes |
| Bullish Belt | opens at its low, below the lowest low of the 10 bars before, and closes up past the middle of the previous bar | yes |
| Bullish / Bearish Kicker | the previous bar is the other colour, and this bar opens at or beyond the previous open | yes |
| Hanging Man | range over 4 times the body, body in the top quarter, and opens above the highs of the two bars before | yes |
| Morning / Evening Star | three bars: a long bar, then a bar whose whole body sits beyond its close, then a reversal bar | none |
| Shooting Star | after an up bar, opens above the previous close, upper shadow at least 3 times the body | none |
| Hammer (H) | range over 3 times the body, body in the top 40% | none |
| Inverted Hammer (IH) | range over 3 times the body, body in the bottom 40% | none |
Three things follow from the code itself:
- Every Hanging Man is also a Hammer. The Hanging Man shape (over 4 times, top quarter) is a stricter copy of the Hammer shape (over 3 times, top 40%). So each Hanging Man label comes with an H diamond under the same bar.
- The Hammer has no trend check. A textbook hammer comes after a fall. Here the H diamond appears on any bar of that shape, in any direction of travel.
- A flat bar can be a Bearish Kicker. The bearish rule accepts a close equal to the open.
The script draws everything from the current bar and the few before it. It asks for no other timeframe and no future bars, so a label on a closed bar stays where it is.
What we checked in Python
We ported the 15 rules to Python and ran them on invented random-walk prices with a typical move of 1% a bar, each bar built from 10 ticks so we could watch the live bar.
Charts with no gaps. On many 24-hour markets each bar opens at the previous bar's close. We built bars that way (10 runs of 3,000 bars). Eight of the 15 patterns never appeared once: Piercing Line, Bullish Belt, both Kickers, Hanging Man, Morning Star, Evening Star and Shooting Star. Each of them needs this bar to open away from the previous close (below the previous low, above the previous highs, or beyond the previous body), and that cannot happen when there is no gap. The rules are written for markets that open with gaps.
Charts with small gaps. With a small opening gap added (a typical size of 0.3%), all 15 appeared. Per 1,000 bars:
| Pattern | Per 1,000 bars |
|---|---|
| Hammer | 81 |
| Inverted Hammer | 79 |
| Doji | 34 |
| Bullish / Bearish Harami | 34 / 33 |
| Bullish / Bearish Engulfing | 29 / 27 |
| Morning / Evening Star | 11 / 12 |
| Bullish / Bearish Kicker | 11 / 9 |
| Piercing Line | 9 |
| Shooting Star | 9 |
| Bullish Belt | 5 |
| Hanging Man | 4 |
Hammer and Inverted Hammer each mark about 1 bar in 12. All 108 Hanging Men were also marked H. About 4 in 5 dojis were also marked H or IH, because a doji with a long shadow on one side passes the hammer test too.
The live bar. While a bar is still forming, its high, low and close move, so a pattern can appear and then go. Of the bars where a Hammer showed at some tick, 75% no longer had it at the close. For the Doji it was 84%, for the Haramis about 65%, and for the Engulfing patterns about 38%. An alert set to fire the first time its condition is true will fire on many bars that end without the pattern.
Very low prices. The Hammer, Inverted Hammer and Hanging Man rules add 0.001 to the bar's range before dividing. On a price near 0.002, that small number is larger than the range itself, and in 3 runs of 3,000 bars no Hammer or Inverted Hammer appeared at all.
These figures describe the code on invented data, not any market.
Where it fails
- Eight patterns need gaps. On charts where each bar opens at the previous close, Piercing Line, Bullish Belt, both Kickers, Hanging Man, both Stars and Shooting Star cannot appear. An empty chart there says nothing about the market.
- Labels on the live bar come and go. In the port, 3 in 4 hammers seen during a bar were gone at its close. Set alerts to "once per bar close" if you want only patterns that survived the bar.
- Doubled labels. Every Hanging Man also carries an H, and most dojis also carry H or IH.
- The trend filter is one comparison. "Trend" means only that the open is higher or lower than 5 bars ago. Hammer, Inverted Hammer, Doji, both Stars and Shooting Star have no trend check at all.
- Hammers are common. On wandering prices, H or IH marked about 1 bar in 6 between them.
- Low-priced symbols lose the hammer family. The fixed 0.001 in the formula swamps ranges on prices below about 0.01. We read this from the code and saw it in the port; we did not test it on a live symbol.
- A label is a shape, not an outcome. The code checks bar shapes only; nothing in it looks at what happens after the label.
Educational only. Not financial advice. Nothing here is a recommendation to buy or sell anything. Candlestick Patterns Identified is by repo32 on TradingView; this page describes its published open-source code in our own words and is not affiliated with the author. Simulation figures come from synthetic random-walk prices and say nothing about how the script behaves on any market.
Also explained: Repaint checker, VWAP, Supertrend, RSI, UT Bot Alerts, Nadaraya-Watson Envelope, Squeeze Momentum, What is repainting on TradingView?, Is TradingView backtesting accurate?, Chandelier Exit, WaveTrend Oscillator, QQE MOD, Pivot highs and lows, Hull Suite, Range Filter, Twin Range Filter, HalfTrend, ZigZag++, SSL Hybrid, CM MacD Ultimate MTF, Volume Profile / Fixed Range, ADX and DI, Support Resistance Channels, Market Structure Break & Order Block, Order Block Finder, Pivot Point SuperTrend, Trendlines with Breaks [LuxAlgo], Divergence for Many Indicators, TradingView script selling terms, Support and Resistance Levels with Break, Liquidity Swings [LuxAlgo], Pine Script errors, Breakout Probability (Expo), Did ChatGPT or Claude write your Pine Sc, Lorentzian Classification, SuperTrend AI (Clustering), Machine Learning Adaptive SuperTrend, Dynamic Swing Anchored VWAP, Support and Resistance Power Channel by , Support and Resistance (High Volume Boxe, Trendline Breakouts With Targets by Char, Breakout Finder by LonesomeTheBlue, Volume Flow Indicator by LazyBear, FVG Order Blocks by BigBeluga, CM_Williams_Vix_Fix by ChrisMoody, Bollinger + RSI Double Strategy by Chart, Ultimate Moving Average MTF by ChrisMood, Fibonacci Bollinger Bands by Rashad, MACD + SMA 200 Strategy by ChartArt, Pine Script v5 to v6, Moving Average Cross Alert, Multi-Timefr, WaveTrend Oscillator [WT] by LazyBear, WaveTrend with Crosses [LazyBear], CM_Price-Action-Bars by ChrisMoody, RSI Candles by glaz, CM RSI-2 Strategy Lower Indicator by Chr, CM Stochastic Multi-TimeFrame by ChrisMo, CM_Ultimate RSI Multi Time Frame by Chri, TonyUX EMA Scalper - Buy / Sell by tux, MACD 4C by vkno422, My Pine Script is valid. What did the va
Get the next teardown by email
One short email when a new teardown or free tool goes live, about twice a month. No signals, no hype. Unsubscribe in one click.
Almost done. Check your inbox and click the confirmation link.
Sent with Kit. Your address is used only for these emails. Privacy
No TradingView account yet? This affiliate link gives you a $15 coupon toward a paid plan, and we earn a commission if you buy one. The free plan is enough to follow this page.