Logo
OFFLINEPIXEL
/ pinescript-strategies / pine-script-shooting-star

$ Pinescript: Shooting Star Candlestick Pattern

Unlock powerful bearish reversal signals with this comprehensive guide to detecting and strategizing with Shooting Star patterns in TradingView's Pinescript.

500+ Clients Helped
100% Satisfaction
Live Trading Ready
⚠️
Trading financial markets carries risk. All content (PineScript code, indicators, strategies) on this website is for educational purposes only. Past performance is not indicative of future results. By using any code or information from this site, you agree that you are solely responsible for your trading decisions. The author disclaims all liability for any losses incurred. To gain from experts experiences, You can always try our Invite Only Scripts
01

Why the Shooting Star Pattern Matters in Pinescript

The Shooting Star candlestick pattern is a single-candle bearish reversal pattern that typically forms after an uptrend. It signals a potential top and a shift in momentum from buyers to sellers. The Shooting Star's unique shape indicates that despite initial buying pressure during the trading period, prices could not be sustained at their highs, and sellers pushed them back down, often near the opening price. This shows that the market struggles to maintain higher prices, making Shooting Star patterns invaluable for:

  • Identifying potential bearish trend reversals.
  • Signaling a rejection of higher prices (resistance).
  • Generating entry signals in short strategies.
02

Understanding the Shooting Star Candlestick Pattern

A Shooting Star candle has a small real body (the difference between open and close) and a long upper shadow (wick) that is typically at least twice the length of the real body. It has little or no lower shadow. The color of the body (bullish or bearish) is less important than its shape and location after an uptrend.

03

Shooting Star Pattern Illustrations

Shooting Star (Bullish Body)

Open below close. Even with a green body, the long upper wick shows rejection of higher prices.

Shooting Star (Bearish Body)

Open above close. A red body reinforces the bearish sentiment.

04

Key Characteristics

Key Characteristics

Small Real Body: The distance between the open and close is small.
Long Upper Shadow: The upper wick is at least twice the length of the real body.
Little or No Lower Shadow: Ideally, there should be no lower wick, or it should be very short.
Context is Critical: Most significant when appearing at the top of a clear uptrend.

05

Basic Shooting Star Pattern Detection in Pinescript

pine-script@terminal
//@version=5
indicator("Shooting Star Pattern Detector", overlay=true)

// Calculate candle body and wick lengths
realBody = math.abs(close - open)
upperShadow = high - math.max(open, close) // Corrected calculation for upper shadow length
lowerShadow = math.min(open, close) - low

// Define Shooting Star criteria
// 1. Small real body
isSmallBody = realBody <= (high - low) * 0.3 // Body is at most 30% of total candle range

// 2. Long upper shadow (at least 2x the body size)
isLongUpperShadow = upperShadow >= realBody * 2

// 3. Little to no lower shadow (lower shadow is at most 50% of body)
isSmallLowerShadow = lowerShadow <= realBody * 0.5
// Alternative for lower shadow: lowerShadow < (high - low) * 0.1

// Combine criteria for Shooting Star
isShootingStar = isSmallBody and isLongUpperShadow and isSmallLowerShadow

// Plot signal on the chart (above the bar for bearish reversal)
plotshape(isShootingStar, title="Shooting Star", location=location.abovebar, color=color.new(color.blue, 0), style=shape.triangledown, size=size.normal)

// Alert condition (optional)
alertcondition(isShootingStar, title="Shooting Star Detected", message="Shooting Star Candlestick Pattern Detected!")
$ ✓ Compiled successfully
06

Advanced Shooting Star Strategies

While basic detection is useful, combining Shooting Star patterns with other indicators and market context provides stronger, more reliable signals for potential reversals.

07

1. Shooting Star with Uptrend Confirmation (Using Moving Average)

pine-script@terminal
//@version=5
strategy("Shooting 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

// Shooting Star Pattern Detection (from basic example)
realBody = math.abs(close - open)
upperShadow = high - math.max(open, close)
lowerShadow = math.min(open, close) - low

isSmallBody = realBody <= (high - low) * 0.3
isLongUpperShadow = upperShadow >= realBody * 2
isSmallLowerShadow = lowerShadow <= realBody * 0.5

isShootingStar = isSmallBody and isLongUpperShadow and isSmallLowerShadow

// 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 = isShootingStar and isUptrend

if (shortSignal)
    strategy.entry("Short", strategy.short)

// Plot MA
plot(ma, "Trend MA", color.blue)

// Plot confirmed signals
plotshape(shortSignal, title="Confirmed Shooting Star", location=location.abovebar, color=color.new(color.fuchsia, 0), style=shape.arrowdown, size=size.normal)
$ ✓ Compiled successfully
08

2. Shooting Star with Volume Confirmation

pine-script@terminal
//@version=5
indicator("Shooting Star with Volume Confirmation", overlay=true)

// Shooting Star Pattern Detection (from basic example)
realBody = math.abs(close - open)
upperShadow = high - math.max(open, close)
lowerShadow = math.min(open, close) - low

isSmallBody = realBody <= (high - low) * 0.3
isLongUpperShadow = upperShadow >= realBody * 2
isSmallLowerShadow = lowerShadow <= realBody * 0.5

isShootingStar = isSmallBody and isLongUpperShadow and isSmallLowerShadow

// Volume Confirmation:
// Shooting Star candle's volume should be significantly 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
confirmedShootingStar = isShootingStar and isVolumeConfirmed

// Plot confirmed signals
barcolor(confirmedShootingStar ? color.new(color.purple, 60) : na)

plotshape(confirmedShootingStar, title="Shooting Star (Vol Confirmed)", location=location.abovebar, color=color.new(color.red, 0), style=shape.labeldown, size=size.small, text="SS 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)
$ ✓ Compiled successfully
09

3. Shooting Star with RSI Confirmation

pine-script@terminal
//@version=5
indicator("Shooting 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)

// Shooting Star Pattern Detection
realBody = math.abs(close - open)
upperShadow = high - math.max(open, close)
lowerShadow = math.min(open, close) - low

isSmallBody = realBody <= (high - low) * 0.3
isLongUpperShadow = upperShadow >= realBody * 2
isSmallLowerShadow = lowerShadow <= realBody * 0.5

isShootingStar = isSmallBody and isLongUpperShadow and isSmallLowerShadow

// 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
signalShootingStar = isShootingStar and rsiConfirmation

// Plot signals
plotshape(signalShootingStar, title="Shooting 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)
$ ✓ Compiled successfully
10

Optimizing Shooting Star Pattern Performance

To maximize the effectiveness of Shooting Star patterns in your Pinescript strategies:

  • Confirm Uptrend: The Shooting Star is a bearish reversal pattern, so it's most reliable when it appears after a clear uptrend. Avoid trading it in a downtrend or sideways market.
  • Volume Confirmation: A Shooting Star candle formed with higher than average volume indicates stronger conviction from sellers and increases the reliability of the signal.
  • Resistance Levels: Shooting Stars that form at significant resistance levels (e.g., previous highs, strong moving averages, Fibonacci levels) are more powerful.
  • Subsequent Candle Confirmation: A strong bearish candle after the Shooting Star further confirms the reversal. Some traders wait for this confirmation before entering a short position.
  • Timeframe: While visible on all timeframes, Shooting Star signals on higher timeframes (e.g., daily, weekly) generally carry more weight and are more reliable for sustained moves than those on lower timeframes.
11

Common Shooting Star Pattern Pitfalls to Avoid

Warning: Not all Shooting Star-shaped candles are valid Shooting Star patterns. Context and confirmation are crucial. A Shooting Star in a downtrend is known as an "Inverted Hammer" and indicates a bullish reversal.
  • Ignoring Trend Context: A Shooting Star pattern is a *bearish reversal* signal. If it appears in a downtrend, it is NOT a Shooting Star and is actually an Inverted Hammer, indicating potential bullishness.
  • Insufficient Upper Shadow: An upper shadow that is not at least twice the real body's length might not indicate strong enough rejection of higher prices.
  • Large Real Body: If the real body is too large, it suggests less indecision and less of a "top-out" scenario.
  • Lack of Confirmation: Relying solely on the Shooting Star pattern without other indicators (volume, resistance, follow-through candles) can lead to false signals.
  • Trading in Choppy Markets: In ranging or sideways markets, Shooting Star patterns are less reliable as there's no clear trend to reverse.
12

Conclusion

Conclusion

The Shooting Star candlestick pattern is a strong and visually intuitive signal for bearish reversals. By understanding its precise characteristics and, more importantly, its contextual significance within an uptrend, you can leverage it effectively in your trading. Implementing Shooting Star detection in Pinescript allows you to automate signal generation, combine it with other technical indicators for higher probability trades, and refine your price action analysis to make more informed trading decisions on TradingView.

Enhance Your Trading

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