Unlock powerful bearish reversal signals with this comprehensive guide to detecting and strategizing with Evening Star patterns in TradingView's Pinescript.
The Evening Star candlestick pattern is a powerful three-candle bearish reversal pattern that typically forms after an uptrend. It signals a potential top and a strong shift in momentum from buyers to sellers. This pattern indicates that buyers were dominant initially, but their power waned, leading to indecision, and then sellers took control, pushing prices significantly lower. This makes Evening Star patterns invaluable for:
An Evening Star pattern consists of three specific candles:
A long green candle, followed by a small star candle (often with a gap up), then a large red candle that pushes back into the first candle's body.
Candle 1: Long bullish candle.
Candle 2 (Star): Small body (spinning top or doji), closes above Candle 1's close. Its real body does not overlap with Candle 1's real body.
Candle 3: Long bearish candle that opens below Candle 2's close and closes significantly into the real body of Candle 1.
Context: Most significant when appearing at the top of a clear uptrend.
//@version=5
indicator("Evening Star Pattern Detector", overlay=true)
// Candle 1 (previous-previous bar) - Long Bullish
isC1Bullish = close[2] > open[2]
isC1Long = (close[2] - open[2]) > ta.atr(10)[2] * 0.5 // Body is significant, e.g., > 0.5 ATR
// Candle 2 (previous bar) - Small Body (Star) and Gaps Up
isC2SmallBody = math.abs(close[1] - open[1]) <= (high[1] - low[1]) * 0.3 // Small body, e.g., <= 30% of range
isC2GapsUp = open[1] > close[2] // Gap up from previous candle's close
isC2Star = isC2SmallBody and isC2GapsUp
// Candle 3 (current bar) - Long Bearish and Gaps Down, closing into C1 body
isC3Bearish = close < open
isC3Long = (open - close) > ta.atr(10) * 0.5 // Body is significant
isC3GapsDown = open < low[1] // Gaps down from previous candle's low
isC3ClosesIntoC1 = close < (open[2] + close[2]) / 2 // Closes below midpoint of C1 body
// Combine all criteria for Evening Star
isEveningStar = isC1Bullish and isC1Long and isC2Star and isC3Bearish and isC3Long and isC3GapsDown and isC3ClosesIntoC1
// Plot signal on the chart
plotshape(isEveningStar, title="Evening Star", location=location.abovebar, color=color.new(color.maroon, 0), style=shape.triangledown, size=size.normal)
// Alert condition (optional)
alertcondition(isEveningStar, title="Evening Star Detected", message="Evening Star Candlestick Pattern Detected!")
Combining Evening Star patterns with other indicators and market context provides stronger, more reliable signals for potential bearish reversals.
//@version=5
strategy("Evening Star with Trend Confirmation", overlay=true)
// Input for Moving Average length
maLength = input(50, "MA Length (for trend)")
ma = ta.ema(close, maLength) // Using EMA for uptrend detection
// Evening Star Pattern Detection (from basic example)
isC1Bullish = close[2] > open[2]
isC1Long = (close[2] - open[2]) > ta.atr(10)[2] * 0.5
isC2SmallBody = math.abs(close[1] - open[1]) <= (high[1] - low[1]) * 0.3
isC2GapsUp = open[1] > close[2]
isC2Star = isC2SmallBody and isC2GapsUp
isC3Bearish = close < open
isC3Long = (open - close) > ta.atr(10) * 0.5
isC3GapsDown = open < low[1]
isC3ClosesIntoC1 = close < (open[2] + close[2]) / 2
isEveningStar = isC1Bullish and isC1Long and isC2Star and isC3Bearish and isC3Long and isC3GapsDown and isC3ClosesIntoC1
// Trend Confirmation: Price should be above the MA (uptrend)
// AND the MA itself should be sloping upwards (optional, but stronger)
isUptrend = close > ma and ma > ma[1]
// Strategy Logic with Trend Confirmation
shortSignal = isEveningStar and isUptrend
if (shortSignal)
strategy.entry("Short", strategy.short)
// Plot MA
plot(ma, "Trend MA", color.blue)
// Plot confirmed signals
plotshape(shortSignal, title="Confirmed Evening Star", location=location.abovebar, color=color.new(color.fuchsia, 0), style=shape.arrowdown, size=size.normal)
//@version=5
indicator("Evening Star with Volume Confirmation", overlay=true)
// Evening Star Pattern Detection (from basic example)
isC1Bullish = close[2] > open[2]
isC1Long = (close[2] - open[2]) > ta.atr(10)[2] * 0.5
isC2SmallBody = math.abs(close[1] - open[1]) <= (high[1] - low[1]) * 0.3
isC2GapsUp = open[1] > close[2]
isC2Star = isC2SmallBody and isC2GapsUp
isC3Bearish = close < open
isC3Long = (open - close) > ta.atr(10) * 0.5
isC3GapsDown = open < low[1]
isC3ClosesIntoC1 = close < (open[2] + close[2]) / 2
isEveningStar = isC1Bullish and isC1Long and isC2Star and isC3Bearish and isC3Long and isC3GapsDown and isC3ClosesIntoC1
// Volume Confirmation:
// Volume on the third bearish candle should be higher than average volume
avgVolume = ta.sma(volume, 20) // 20-period Simple Moving Average of Volume
isVolumeConfirmed = volume > avgVolume * 1.5 // Volume is 1.5x average
// Combined signal
confirmedEveningStar = isEveningStar and isVolumeConfirmed
// Plot confirmed signals
barcolor(confirmedEveningStar ? color.new(color.purple, 60) : na)
plotshape(confirmedEveningStar, title="Evening Star (Vol Confirmed)", location=location.abovebar, color=color.new(color.red, 0), style=shape.labeldown, size=size.small, text="ES Vol")
// Optional: Plot volume for visual check
plot(volume, title="Volume", color=color.gray, style=plot.style_columns)
plot(avgVolume, title="Avg Volume", color=color.orange, style=plot.style_line)
//@version=5
indicator("Evening Star with RSI Confirmation", overlay=true)
// RSI Inputs
rsiLength = input(14, "RSI Length")
overbought = input(70, "RSI Overbought Level")
// Calculate RSI
rsiValue = ta.rsi(close, rsiLength)
// Evening Star Pattern Detection
isC1Bullish = close[2] > open[2]
isC1Long = (close[2] - open[2]) > ta.atr(10)[2] * 0.5
isC2SmallBody = math.abs(close[1] - open[1]) <= (high[1] - low[1]) * 0.3
isC2GapsUp = open[1] > close[2]
isC2Star = isC2SmallBody and isC2GapsUp
isC3Bearish = close < open
isC3Long = (open - close) > ta.atr(10) * 0.5
isC3GapsDown = open < low[1]
isC3ClosesIntoC1 = close < (open[2] + close[2]) / 2
isEveningStar = isC1Bullish and isC1Long and isC2Star and isC3Bearish and isC3Long and isC3GapsDown and isC3ClosesIntoC1
// RSI Confirmation: RSI should be in overbought territory or falling from it
rsiConfirmation = rsiValue >= overbought or (rsiValue[1] >= overbought and rsiValue < rsiValue[1])
// Combined signal
signalEveningStar = isEveningStar and rsiConfirmation
// Plot signals
plotshape(signalEveningStar, title="Evening Star (RSI Confirmed)", location=location.abovebar, color=color.new(color.orange, 0), style=shape.arrowdown, size=size.normal)
// Plot RSI in a separate pane
plot(rsiValue, "RSI", color.blue, linewidth=2, display=display.pane)
hline(overbought, "Overbought", color.red)
To maximize the effectiveness of Evening Star patterns in your Pinescript strategies:
The Evening Star candlestick pattern is a well-regarded and visually clear signal for bearish reversals. By understanding its precise three-candle formation, its contextual importance within an uptrend, and integrating it with other technical confirmations, you can leverage it effectively in your trading. Implementing Evening Star detection in Pinescript allows you to automate signal generation, combine it with complementary indicators for higher probability trades, and enhance your price action analysis to make more informed trading decisions on TradingView.
Get a high-performance Pinescript analysis tool for actionable market insights, designed for traders on the move.
This strategy runs in live mode on TradingView, helping you identify potential opportunities.
Get Pinescript Strategy