Home » Candlestick Patterns » Detecting Bullish Homing Pigeon Candlestick Pattern in Pine Script

Detecting Bullish Homing Pigeon Candlestick Pattern in Pine Script

Photo of author
Published on

Overview of Bullish Homing Pigeon Candlestick Pattern

The Bullish Homing Pigeon Candlestick Pattern is a significant formation in technical analysis, often indicating potential bullish reversals in a bearish market. Here’s an overview of its characteristics and implications:

Bullish Homing Pigeon Candlestick Pattern

Definition and Structure

  • Formation: This pattern consists of two candlesticks within a downtrend.
  • Appearance:
    • First Candle: A long, bearish (black or red) candle, signifying a strong downward move.
    • Second Candle: A smaller bearish candle, entirely contained within the range of the first candle’s body. This candle represents a continued, but weakening, bearish sentiment.
  • Color: Both candles are typically the same color, usually red or black, indicating closing prices lower than opening prices.

Importance in Technical Analysis

The Bullish Homing Pigeon Candlestick Pattern holds significant importance in technical analysis due to its potential to signal a reversal in bearish market trends. Here’s a breakdown of its importance:

  • Predictive Nature: This pattern can serve as an early indicator of a possible shift from a bearish to a bullish trend, allowing traders to prepare for a potential change in market direction.
  • Opportunity for Entry: For investors and traders looking to enter long positions, the Bullish Homing Pigeon can provide an opportune moment to do so, potentially ahead of a market upturn.
  • Market Sentiment: This pattern captures a moment where selling pressure begins to wane, reflecting a change in trader psychology and sentiment. The smaller second candle suggests that bears are losing control, potentially leading to a bullish takeover.
  • Confidence in Decision Making: Recognizing this pattern helps traders gain confidence in their analysis, particularly in the context of a broader downtrend.
  • Stop Loss Strategy: The clearly defined low points of the candles in this pattern can help in setting effective stop-loss orders, allowing for more controlled risk management.

Example From Trading View

Example From Trading View

Defining the Bullish Homing Pigeon Candlestick Pattern Criteria

Defining the criteria for the Bullish Homing Pigeon Candlestick Pattern is crucial for accurate identification and analysis in technical trading. Here are the key criteria that characterize this pattern:

  1. Two-Candle Formation: The pattern consists of two consecutive candlesticks occurring during a downtrend or a bearish market context.
  2. Large Bearish Candle: The first candle is a large, bearish one, indicating a strong downward price movement. The color of the candle is typically black or red, showing that the closing price is lower than the opening price.
  3. Smaller Bearish Candle: The second candle is smaller in comparison to the first candle. It is also bearish (black or red), suggesting that the closing price is again lower than the opening price.
  4. Engulfed by the First Candle: The body of the second candle is completely contained within the vertical range of the body of the first candle. This means that the high and low prices of the second candle are within the high and low of the first candle’s body.

Code For Detecting Bullish Homing Pigeon

//@version=5
indicator("Bullish Homing Pigeon Pattern", shorttitle="BHP", overlay=true)

// Define the Bullish Homing Pigeon criteria
isBullishHomingPigeon() =>
    // Criteria for the first (larger) candle
    bearish1 = close[1] < open[1]
    body1 = math.abs(close[1] - open[1])

    // Criteria for the second (smaller) candle
    bearish2 = close < open
    body2 = math.abs(close - open)

    // The second candle's body is within the first candle's range
    withinFirstCandle = low >= low[1] and high <= high[1] and close> close[1]

    // The second candle is smaller than the first
    smallerBody = body2 < body1

    // Overall pattern criteria
    bearish1 and bearish2 and withinFirstCandle and smallerBody

// Plotting
if isBullishHomingPigeon()
    label.new(bar_index[1], high[1], "Bullish Homing Pigeon", color=color.green, textcolor=color.white, style=label.style_label_down, yloc=yloc.abovebar)

Output

Output

Overview of the script 

1. Script Declaration

//@version=5
indicator("Bullish Homing Pigeon Pattern", shorttitle="BHP", overlay=true)
  • //@version=5: This line indicates that the script is written in Pine Script version 5, the latest version available at the time of writing.
  • indicator(...): This function declares the script as a custom indicator. It sets the name of the indicator as “Bullish Homing Pigeon Pattern” and its short title as “BHP”. The overlay=true parameter means the indicator will be plotted on the main price chart.

2. Function Definition

isBullishHomingPigeon() =>
  • isBullishHomingPigeon() =>: This line defines a function called isBullishHomingPigeon. The function will contain the logic to identify the Bullish Homing Pigeon pattern.

3. First Candle Criteria

    bearish1 = close[1] < open[1]
    body1 = math.abs(close[1] - open[1])
  • bearish1 = close[1] < open[1]: This line checks if the first candle (previous candle) is bearish. It compares the closing price (close[1]) with the opening price (open[1]) of the first candle. If the close is less than the open, the candle is bearish, and bearish1 is set to true.
  • body1 = math.abs(close[1] - open[1]): Calculates the absolute size of the first candle’s body. It subtracts the opening price from the closing price of the first candle and takes the absolute value to ensure a positive number.

4. Second Candle Criteria

    bearish2 = close < open
    body2 = math.abs(close - open)
    withinFirstCandle = low >= low[1] and high <= high[1] and close> close[1]
    smallerBody = body2 < body1
  • bearish2 = close < open: Similar to bearish1, this checks if the current (second) candle is bearish.
  • body2 = math.abs(close - open): Calculates the absolute size of the second candle’s body.
  • withinFirstCandle = low >= low[1] and high <= high[1] and close> close[1]: This line checks if the second candle is completely within the range of the first candle’s body. It ensures the low of the second candle is not lower than the low of the first, and its high is not higher than the high of the first. The additional condition close > close[1] seems incorrect for the pattern and might need to be removed.
  • smallerBody = body2 < body1: Checks if the body of the second candle is smaller than the body of the first candle.

5. Overall Pattern Criteria

    bearish1 and bearish2 and withinFirstCandle and smallerBody
  • This line combines all the individual criteria. It returns true if both candles are bearish, the second candle’s body is within the first candle’s range, and the second candle’s body is smaller than the first’s.

6. Plotting the Pattern

if isBullishHomingPigeon()
    label.new(bar_index[1], high[1], "Bullish Homing Pigeon", color=color.green, textcolor=color.white, style=label.style_label_down, yloc=yloc.abovebar)
  • if isBullishHomingPigeon(): This checks if the function isBullishHomingPigeon returns true, indicating that the Bullish Homing Pigeon pattern is found.
  • label.new(...): This creates a new label on the chart. The label is placed at the bar index of the first candle (bar_index[1]) and above the highest price of the first candle (high[1]). The label text is “Bullish Homing Pigeon”, with a green background and white text. The label is styled to point downwards and positioned above the bar.

Frequently Asked Questions

What does the Bullish Homing Pigeon Pattern indicate in this script?

The script detects a potential bullish reversal during a downtrend, characterized by two bearish candles where the second is smaller and fully contained within the first.

How does the script determine a bearish candle?

A candle is considered bearish if its closing price is lower than its opening price, indicated by close < open in the code.

Why does the script use label.new for plotting?

label.new creates a visual label on the chart, making it easier to identify where the Bullish Homing Pigeon pattern occurs, enhancing its visibility for analysis.

Can this script be used for real-time trading decisions?

While it can be a helpful tool, it’s recommended to use this script along with other indicators and market analysis for making informed trading decisions.

Is the Bullish Homing Pigeon pattern a strong indicator of market reversal?

This pattern suggests a potential reversal, but it should be validated with additional indicators and market context for reliability. It’s not a standalone guarantee of market reversal.

Conclusion

The provided Pine Script code is a practical tool for traders utilizing technical analysis on TradingView. It automates the detection of the Bullish Homing Pigeon pattern by methodically analyzing candlestick formations and offering clear visual cues through labels on the chart. This enhancement in the decision-making process aids traders in identifying key patterns without manually scanning charts, thereby increasing efficiency and accuracy in their trading strategies. For more reliable trading insights, it’s advisable to combine this pattern’s detection with other technical indicators and a comprehensive market analysis. This balanced approach helps mitigate risks associated with relying solely on a single pattern and ensures a more robust trading strategy.

Leave a Comment