Candlestick patterns: the 44 pattern scripts and their alerts
The candlestick patterns in SuperCharting's library: hammer, engulfing, doji, morning star and 40 more, the trend filter, labels and pattern alerts.
SuperCharting's library has 44 candlestick pattern scripts, from Hammer and Engulfing to Three white soldiers and Abandoned baby, plus All candlestick patterns, which runs them together. Each one marks the candle where its pattern formed with a short label and a tooltip explaining the pattern, and each can send an alert. You find them under Indicators → Technicals → Patterns, after the chart patterns.
The pattern list
| Kind | Patterns |
|---|---|
| Single-candle bullish | Hammer, Inverted hammer, Dragonfly Doji, Long lower shadow, Marubozu white |
| Single-candle bearish | Hanging man, Shooting star, Gravestone Doji, Long upper shadow, Marubozu black |
| Neutral | Doji, Spinning top black, Spinning top white |
| Two-candle bullish | Engulfing, Harami, Harami cross, Piercing, Kicking, Tweezer bottom, Doji star, Rising window |
| Two-candle bearish | Engulfing, Harami, Harami cross, Dark cloud cover, Kicking, Tweezer top, Doji star, Falling window, On-neck |
| Three-candle and longer | Morning star, Evening star, Morning Doji star, Evening Doji star, Abandoned baby (both), Tri-star (both), Three white soldiers, Three black crows, Rising three methods, Falling three methods, Upside Tasuki gap, Downside Tasuki gap |
In the dialog each one is named with its direction, for example "Engulfing (bullish)" or "Doji (neutral)". The scripts carry the same names as TradingView's candlestick pattern built-ins.
How the scripts decide
The scripts compare each candle with an average body size: a 14-bar EMA of body length. A "small body" is smaller than that average, a "long body" larger. Shadows count when they are more than 5% of the body. Each pattern then has its own geometry. For example, a Hammer needs:
- a small body in the upper half of the candle,
- a lower shadow at least twice the body,
- no meaningful upper shadow,
- and a downtrend.
The trend filter
Reversal patterns only count in the right context. Detect Trend Based On has three options:
- SMA50 (default): a downtrend means the close is below the 50-bar SMA, an uptrend above it.
- SMA50, SMA200: a downtrend needs close below SMA50 and SMA50 below SMA200, and the reverse for an uptrend.
- No detection: patterns are marked regardless of trend.
So a hammer shape above the 50 SMA is not labelled with the default setting. Switch to No detection if you want every shape marked.
How to add candlestick patterns in SuperCharting
- Open a chart, for example NSE:HDFCBANK on the 1D interval.
- Click Indicators, choose Technicals and then the Patterns chip.
- Type the pattern's name in Search, for example "engulf", and click Engulfing (bullish). Or click All candlestick patterns.
- Open Settings from the legend gear.
- In All candlestick patterns, set Pattern Type to Bullish, Bearish or Both, and untick the patterns you do not want.
- Set Detect Trend Based On and the label colours for bullish, bearish and neutral patterns.
- Click Ok.
Reading the labels
Each pattern is marked with a short code: "H" for Hammer, "BE" for Engulfing, "MS" for Morning star, "3WS" for Three white soldiers, "D" for Doji. Bullish labels sit below the candle and bearish ones above. Hover a label for the pattern's name and a description. The single-pattern scripts also tint the background of the candles that make up the pattern.
Alerts on candlestick patterns
Unlike the chart-pattern scripts, every candlestick script defines an alert:
- A single-pattern script has one condition, New pattern detected.
- All candlestick patterns has one condition per pattern, such as "Hammer – Bullish" or "Evening Star – Bearish".
Steps
- Add the pattern script to the chart, for example Hammer (bullish) on EURUSD 1h.
- In its legend's More menu choose Add alert on ….
- Pick New pattern detected (or a named pattern in the combined script).
- Set Trigger to Once per bar close. A pattern is only complete when its last candle closes.
- Choose Expiration and notifications, then click Create.
An alert runs the script with its default inputs, so the alert uses the SMA50 trend rule even if you changed it in Settings. To alert on your own rule, copy the pattern into a script of your own. This example marks inside bars whose previous "mother" bar was at least 0.3% of price tall:
//@version=6
indicator("Inside bar finder", "Inside bar", overlay = true)
minRangePct = input.float(0.3, "Mother bar range (% of price)", minval = 0, step = 0.1)
motherRange = high[1] - low[1]
inside = high < high[1] and low > low[1] and motherRange >= close[1] * minRangePct / 100
plotshape(inside, "Inside bar", shape.circle, location.abovebar, color.orange, size = size.tiny)
alertcondition(inside, "Inside bar", "Inside bar found")
Save it in the Script Editor and add it from My scripts. Write your first indicator walks through each line of a script like this, and price alerts covers the alert dialog in full.
Using candlestick patterns sensibly
- Context first. A hammer at a well-tested support level or the lower edge of a range is read very differently from one in the middle of nowhere. Combine patterns with levels, chart patterns or a trend filter.
- Timeframe matters. On 1-minute charts, patterns appear constantly and mean little. Many traders only use them on 1h and above.
- Gaps differ by market. Patterns built on gaps, such as windows, Kicking and Abandoned baby, appear often on NSE stocks, which gap between sessions. They are rare on 24-hour markets such as BTCUSD.
- Test before trusting. Write the pattern into a strategy and check it in the Strategy Tester. Past results do not guarantee future results.
Nothing on this page is a recommendation to buy or sell.
Frequently asked questions
Why is a hammer on my chart not labelled?
The default trend filter only accepts a hammer when the close is below the 50-bar SMA. Set Detect Trend Based On to No detection to see every hammer shape.
Do the patterns work on Heikin Ashi candles?
Heikin Ashi candles are averaged and rarely have the bodies and shadows these rules expect. For candlestick patterns use regular candles; see chart types.
Can I use All candlestick patterns and still alert on just one?
Yes. Its alert list has one condition per pattern. Pick only the pattern you want.
Does a label ever disappear?
A pattern is judged on closed candles. While the last candle of a pattern is still forming, the label can appear and disappear as price moves. Once that candle closes, it stays.