The Engulfing Candles indicator automatically identifies and highlights bullish and bearish engulfing candlestick patterns directly on the price chart.
1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
38 lines of Pine Script v6 from scripts/engulfing-candles.pine.txt, published under MPL-2.0. Keep the author's credit and licence lines when you reuse it.
engulfing-candles.pine.txt
//@version=6
indicator("Engulfing Candles", overlay = true)
// 1. Settings: how much bigger the new candle must be
minRatio = input.float(1.0, "Body size vs previous", minval = 0.5, step = 0.1)
showBars = input.bool(true, "Colour engulfing candles")
// 2. Body size = the distance between open and close
body = math.abs(close - open)
prevBody = math.abs(close[1] - open[1])
// 3. Which way did each candle move?
isGreen = close > open
isRed = close < open
prevGreen = close[1] > open[1]
prevRed = close[1] < open[1]
// 4. Bullish engulfing: a red candle, then a bigger green one around it
wrapsUp = close >= open[1] and open <= close[1]
bullEngulf = prevRed and isGreen and wrapsUp and body > prevBody * minRatio
// 5. Bearish engulfing: a green candle, then a bigger red one around it
wrapsDown = close <= open[1] and open >= close[1]
bearEngulf = prevGreen and isRed and wrapsDown and body > prevBody * minRatio
// 6. Label them on the chart
plotshape(bullEngulf, "Bullish engulfing", shape.labelup, location.belowbar,
color.green, text = "BULL", textcolor = color.white, size = size.small)
plotshape(bearEngulf, "Bearish engulfing", shape.labeldown, location.abovebar,
color.red, text = "BEAR", textcolor = color.white, size = size.small)
// 7. Paint the engulfing candle itself
engulfColor = bullEngulf ? color.aqua : bearEngulf ? color.orange : na
barcolor(showBars ? engulfColor : na)
// 8. Alerts you can switch on
alertcondition(bullEngulf, "Bullish engulfing", "{{ticker}} bullish engulfing")
alertcondition(bearEngulf, "Bearish engulfing", "{{ticker}} bearish engulfing")
Overview
Engulfing Candles checks whether the current bar fully wraps around the body of the previous bar and exceeds a customizable minimum body size ratio. When a pattern occurs, the script places text labels above or below the bar, optionally colors the candle, and provides alert triggers. It operates on confirmed candle data directly on the main price chart.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Body size vs previous
float
1.0
minRatio
Colour engulfing candles
bool
true
showBars
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
The Heikin-Ashi Chart Identifier is an indicator that checks if the current chart uses Heikin-Ashi candles. It tracks matched candles where open equals the average of previous open and close, and verifies no gaps between bars. When conditions match, it display
The indicator plots ICT displacement candles on the price chart and can switch to retracement scanning. Displacement requires a move larger than a set share of the 14-bar average high-low range, lasting at least a chosen number of bars, with optional close, pr
All Candlestick Patterns detects and highlights a wide range of bullish, bearish, and neutral candlestick patterns directly on the price chart. It features optional trend filtering using either a 50-period simple moving average or a combination of 50-period an
Mean Reversion Study is an indicator that identifies trade setups combining exponential moving averages, RSI extremes, and engulfing candlestick patterns. It highlights bullish setups when a bullish engulfing candle forms below the EMA while RSI is oversold, a
This indicator overlays up to five higher-timeframe candlestick groups on the price chart. For each enabled timeframe it requests open, high, low, and close and can show up to five candles, offset by a spacing setting. The main inputs set the candle count, the
This indicator detects a large set of classic candlestick patterns and plots colored labels on the price chart. Trend context uses a 50-period simple moving average, or the 50 and 200 averages stacked together, and can be switched off. Users filter bullish, be