Home » Candlestick Patterns » Detecting Three Stars In The South Candlestick Pattern in Pine Script

Detecting Three Stars In The South Candlestick Pattern in Pine Script

Photo of author
Published on

Overview of Three Stars In The South Candlestick Pattern


The “Three Stars in the South” is a rare but noteworthy candlestick pattern used in technical analysis, typically indicating a bullish reversal. It unfolds over three days, beginning with a long bearish candle that has a significantly lower shadow, suggesting a potential end to the prevailing bearish trend.

Three Stars In The South Candlestick Pattern

The second candle is smaller, bearish, and opens within the range of the first candle’s body, but importantly, it possesses a shorter lower shadow, indicating a decrease in selling pressure. The pattern concludes with a third small bearish candle, which is contained within the range of the second candle, further signaling a weakening of the bearish trend. This pattern is often interpreted as a sign of a potential bottom and a precursor to a bullish reversal, especially when confirmed by subsequent bullish price action.

Importance in Technical Analysis

In technical analysis, the “Three Stars in the South” candlestick pattern is important for several reasons:

  1. Bullish Reversal Signal: It is a reliable indicator of a potential bullish reversal, particularly in a downtrend. This pattern suggests that the bearish momentum is waning and a bullish trend might be on the horizon.
  2. Strength Indicator: The gradual reduction in the size of the candles and their shadows in this pattern reflects the diminishing selling pressure, which is a key insight for traders anticipating a trend reversal.
  3. Psychological Insight: This pattern offers valuable insight into market psychology, illustrating a shift from bearish to bullish sentiment among traders.
  4. Confirmation Requirement: The pattern typically requires confirmation from subsequent candles or additional technical indicators, encouraging a more comprehensive analysis approach.
  5. Rarity and Significance: As a relatively rare pattern, its occurrence is often given more weight by traders and analysts, making it a noteworthy signal for potential market shifts.

Example From Trading View

Example From Trading View

Defining the Three Stars In The South Candlestick Pattern Criteria


The “Three Stars in the South” candlestick pattern is defined by specific criteria that make it a unique and reliable signal in technical analysis:

  1. First Candle: The pattern starts with a long bearish candlestick that appears during a downtrend. This candle should have a substantial body with a long lower shadow, indicating strong selling pressure but with some buying interest at lower levels.
  2. Second Candle: The second candle, also bearish, is smaller and opens within the body of the first candle. It should have a lower shadow, but this shadow is typically shorter than the first candle’s shadow, signaling a decrease in selling momentum.
  3. Third Candle: The final candle in the pattern is a small bearish candlestick, which is contained within the range of the second candle. It usually has little to no shadow, indicating that sellers are losing their grip and a potential reversal is near.

Code For Detecting Three Stars In The South

//@version=5
indicator("Three Stars In The South", overlay=true)

// Scanner algorithms
candle_two = (close[2] < open[2]) and (high[2] == open[2]) and ((close[2] - low[2]) >= (open[2] - close[2]))
candle_one = (close[1] < open[1]) and ((open[1] - close[1]) < (open[2] - close[2])) and (low[1] > low[2])
candle_zero = (close < open) and (high == open) and (low == close) and (close <= high[1]) and (close >= low[1])
tsits = candle_two and candle_one and candle_zero

// Create a label for the Three Stars In The South pattern
if tsits
    label.new(bar_index, high, "Three Stars In The South", style=label.style_label_down, color=color.green,yloc = yloc.abovebar)

Output

Output

Overview of the script 

1. Indicator Declaration

//@version=5
indicator("Three Stars In The South", overlay=true)
  • //@version=5: Specifies that this script uses version 5 of Pine Script.
  • indicator("Three Stars In The South", overlay=true): Declares a new indicator named “Three Stars In The South”. The overlay=true parameter indicates that this indicator will be drawn directly over the price chart.

2. Second Candle from the Current (candle_two)

candle_two = (close[2] < open[2]) and (high[2] == open[2]) and ((close[2] - low[2]) >= (open[2] - close[2]))

This line defines the criteria for the candle two bars back (candle_two). The conditions are:

  • It’s a bearish candle (close[2] < open[2]).
  • It has no upper shadow (high[2] == open[2]).
  • The length of its lower shadow is at least as long as its body ((close[2] - low[2]) >= (open[2] - close[2])).

3. Previous Candle (candle_one)

candle_one = (close[1] < open[1]) and ((open[1] - close[1]) < (open[2] - close[2])) and (low[1] > low[2])

This defines the criteria for the previous candle (candle_one):

  • It’s a bearish candle (close[1] < open[1]).
  • Its body is shorter than the body of candle_two ((open[1] - close[1]) < (open[2] - close[2])).
  • It has a higher low compared to candle_two (low[1] > low[2]).

4. Current Candle (candle_zero)

candle_zero = (close < open) and (high == open) and (low == close) and (close <= high[1]) and (close >= low[1])

This defines the criteria for the current candle (candle_zero):

  • It’s a bearish candle (close < open).
  • It has no upper shadow (high == open) and no lower shadow (low == close).
  • Its close is within the range of candle_one (close <= high[1] and close >= low[1]).

5. Combining Conditions to Identify the Pattern

tsits = candle_two and candle_one and candle_zero
  • tsits is a boolean variable that becomes true if all conditions for the three candles are met, indicating the presence of the “Three Stars In The South” pattern.

6. Creating a Label for the Pattern

if tsits
    label.new(bar_index, high, "Three Stars In The South", style=label.style_label_down, color=color.green, yloc = yloc.abovebar)
  • This block creates a label on the chart when the tsits condition is true (i.e., when the pattern is identified).
  • label.new(...) creates a new label.
  • bar_index and high determine the label’s position (at the high of the current bar).
  • The label text is “Three Stars In The South”.
  • style=label.style_label_down sets the label style to a downward-pointing arrow.
  • color=color.green defines the label color as green.
  • yloc = yloc.abovebar positions the label above the bar to ensure it doesn’t interfere with the visibility of the candlestick pattern.

Frequently Asked Questions

What does the “Three Stars In The South” Pine Script identify?

It detects the “Three Stars In The South” candlestick pattern, a potential bullish reversal indicator.

How does the script determine the pattern’s formation?

The script checks for specific characteristics in three consecutive candles, as per the pattern’s criteria.

What does label.new do in the code?

It creates a label on the chart where the pattern is identified, for easy visualization.

Can this script be used in older versions of Pine Script?

No, it’s specifically designed for Pine Script version 5.

Is the pattern’s detection automatic with this script?

Yes, the script automatically identifies the pattern when its conditions are met.

Conclusion

This script is designed for detecting the “Three Stars In The South” candlestick pattern, a notable indicator in technical analysis for potential bullish reversals. Automating pattern recognition, it aids traders in quickly identifying significant trend changes, enhancing their decision-making process. The script’s use of visual labels makes the pattern easily identifiable on charts, providing a clear and immediate signal. Designed for Pine Script version 5, this tool is an essential addition for traders who incorporate candlestick patterns into their trading strategies, while also emphasizing the importance of combining such patterns with other forms of technical analysis for more comprehensive market insights.

Leave a Comment