Home » Candlestick Patterns » Detecting Bullish Kicking Candlestick Pattern in Pine Script

Detecting Bullish Kicking Candlestick Pattern in Pine Script

Photo of author
Published on

Overview of Bullish Kicking Candlestick Pattern

The Bullish Kicking Candlestick Pattern is a notable configuration in the world of technical analysis, often signaling a strong bullish reversal. It’s the opposite of the Bearish Kicking pattern and is characterized by the following features:

Bullish Kicking Candlestick Pattern
  1. Two Candlesticks: The pattern consists of two main candlesticks:
    • First Candlestick: A bearish candle, typically black or red, representing a day where the closing price is lower than the opening price.
    • Second Candlestick: A bullish candle, usually white or green, which opens at a price higher than the previous day’s close and closes even higher.
  2. Gap Up: A crucial element of the Bullish Kicking pattern is the gap between the two candlesticks. The second candlestick (bullish) should open at a higher price than the first candlestick’s (bearish) closing price, creating a gap in the price chart.
  3. Strong Reversal Signal: This pattern is considered a strong signal for a bullish reversal. The sudden shift from a bearish to a bullish sentiment, especially when it occurs after a downtrend or in a bearish market context, can indicate a significant change in market dynamics.

Importance in Technical Analysis

The Kicker Pattern holds significant importance in technical analysis for several reasons:

  1. Strong Reversal Indicator: The Kicker Pattern is considered one of the most powerful candlestick patterns for signaling a reversal in price trend. Its occurrence is a strong indicator that the current trend may be about to change direction.
  2. High Reliability: Due to its distinctive formation, the Kicker Pattern is seen as a highly reliable signal. The abrupt gap and change in candlestick colors (from bullish to bearish, or vice versa) reduce the likelihood of a false signal.
  3. Reflects Market Sentiment Shift: This pattern vividly captures a sudden shift in market sentiment. The drastic change from one candlestick to the next suggests a strong buying or selling pressure that has entered the market.
  4. Versatility: The Kicker Pattern can be applied across various financial markets, including stocks, forex, and commodities, and is effective in multiple time frames, from short-term to long-term charts.
  5. Enhances Decision-Making: For traders and investors, recognizing a Kicker Pattern can inform crucial decisions such as entering or exiting positions, thereby aiding in risk management and strategic planning.

Example From Trading View

Example From Trading View

Defining the Bullish Kicking Candlestick Pattern Criteria 

The Bullish Kicking Candlestick Pattern is a specific formation in technical analysis that signals a strong bullish reversal. To accurately identify this pattern, certain criteria must be met:

  1. Two Contrasting Candlesticks: The pattern comprises two candlesticks:
    • The first is a bearish candle, typically black or red, where the closing price is lower than the opening price.
    • The second is a bullish candle, usually white or green, where the closing price is higher than the opening price.
  2. Gap Up Opening: A key feature of the Bullish Kicking pattern is the gap between the two candlesticks. The bullish candle must open at a price higher than the bearish candle’s closing price, creating a noticeable gap.
  3. No Overlap in Real Bodies: There should be no overlap between the real bodies of the two candlesticks. This means the opening price of the bullish candlestick is higher than the highest price (including wicks) of the bearish candlestick.
  4. Occurrence in Any Market Condition: While the Bullish Kicking pattern can occur in any market condition, it’s particularly significant when it appears during a downtrend or in a bearish market, as it strongly suggests a reversal.
  5. Strong Volume on the Bullish Candlestick: Ideally, the appearance of the Bullish Kicking pattern should be accompanied by an increase in volume on the bullish candlestick day, reinforcing the strength of the new bullish sentiment.

Code For Detecting Bullish Kicking

//@version=5
indicator("Kicking - Bullish", shorttitle = "Kicking ", overlay=true)
C_Len = 14 // ta.ema depth for bodyAvg
C_ShadowPercent = 5.0 // size of shadows
C_ShadowEqualsPercent = 100.0
C_DojiBodyPercent = 5.0
C_Factor = 2.0 // shows the number of times the shadow dominates the candlestick body

C_BodyHi = math.max(close, open)
C_BodyLo = math.min(close, open)
C_Body = C_BodyHi - C_BodyLo
C_BodyAvg = ta.ema(C_Body, C_Len)
C_SmallBody = C_Body < C_BodyAvg
C_LongBody = C_Body > C_BodyAvg
C_UpShadow = high - C_BodyHi
C_DnShadow = C_BodyLo - low
C_HasUpShadow = C_UpShadow > C_ShadowPercent / 100 * C_Body
C_HasDnShadow = C_DnShadow > C_ShadowPercent / 100 * C_Body
C_WhiteBody = open < close
C_BlackBody = open > close
C_Range = high-low
C_IsInsideBar = C_BodyHi[1] > C_BodyHi and C_BodyLo[1] < C_BodyLo
C_BodyMiddle = C_Body / 2 + C_BodyLo
C_ShadowEquals = C_UpShadow == C_DnShadow or (math.abs(C_UpShadow - C_DnShadow) / C_DnShadow * 100) < C_ShadowEqualsPercent and (math.abs(C_DnShadow - C_UpShadow) / C_UpShadow * 100) < C_ShadowEqualsPercent
C_IsDojiBody = C_Range > 0 and C_Body <= C_Range * C_DojiBodyPercent / 100
C_Doji = C_IsDojiBody and C_ShadowEquals

patternLabelPosLow = low - (ta.atr(30) * 0.6)
patternLabelPosHigh = high + (ta.atr(30) * 0.6)

label_color_bullish = input(color.rgb(30, 255, 49), "Label Color Bullish")
C_KickingBullishNumberOfCandles = 2
C_MarubozuShadowPercent = 5.0
C_Marubozu = C_LongBody and C_UpShadow <= C_MarubozuShadowPercent/100*C_Body and C_DnShadow <= C_MarubozuShadowPercent/100*C_Body
C_MarubozuWhiteBullishKicking = C_Marubozu and C_WhiteBody
C_MarubozuBlackBullish = C_Marubozu and C_BlackBody
C_KickingBullish = C_MarubozuBlackBullish[1] and C_MarubozuWhiteBullishKicking and high[1] < low
alertcondition(C_KickingBullish, title = "New pattern detected", message = "New Kicking – Bullish pattern detected")
if C_KickingBullish
    var ttBullishKicking = "Kicking\nThe first day candlestick is a bearish marubozu candlestick with next to no upper or lower shadow and where the price opens at the day’s high and closes at the day’s low. The second day is a bullish marubozu pattern, with next to no upper or lower shadow and where the price opens at the day’s low and closes at the day’s high. Additionally, the second day gaps up extensively and opens above the opening price of the day before. This gap or window, as the Japanese call it, lies between day one and day two’s bullish candlesticks."
    label.new(bar_index, patternLabelPosLow, text="Kicking", style=label.style_label_up, color = label_color_bullish, textcolor=color.rgb(0, 0, 0), tooltip = ttBullishKicking)
bgcolor(ta.highest(C_KickingBullish?1:0, C_KickingBullishNumberOfCandles)!=0 ? color.new(#21f360, 90) : na, offset=-(C_KickingBullishNumberOfCandles-1))

Output

Output

Overview of the script 

Script Header

//@version=5
indicator("Kicking - Bullish", shorttitle = "Kicking ", overlay=true)
  • //@version=5: Specifies that the script uses version 5 of Pine Script.
  • indicator(...): Defines the script as a custom indicator named “Kicking – Bullish”. The shorttitle is “Kicking” for ease of identification, and overlay=true indicates that this indicator will be drawn over the main price chart.

Configuration Variables

C_Len = 14 // ta.ema depth for bodyAvg
C_ShadowPercent = 5.0 // size of shadows
C_ShadowEqualsPercent = 100.0
C_DojiBodyPercent = 5.0
C_Factor = 2.0 // shows the number of times the shadow dominates the candlestick body

These lines define various configuration variables for the script:

  • C_Len: The number of periods used for calculating the Exponential Moving Average (EMA) of the candlestick body length.
  • C_ShadowPercent: The percentage used to determine the significance of a candlestick’s shadows.
  • C_ShadowEqualsPercent, C_DojiBodyPercent, C_Factor: Parameters used in later calculations for identifying specific types of candlesticks (like Doji).

Calculation of Candlestick Components

C_BodyHi = math.max(close, open)
C_BodyLo = math.min(close, open)
C_Body = C_BodyHi - C_BodyLo
C_BodyAvg = ta.ema(C_Body, C_Len)
C_SmallBody = C_Body < C_BodyAvg
C_LongBody = C_Body > C_BodyAvg
C_UpShadow = high - C_BodyHi
C_DnShadow = C_BodyLo - low
C_HasUpShadow = C_UpShadow > C_ShadowPercent / 100 * C_Body
C_HasDnShadow = C_DnShadow > C_ShadowPercent / 100 * C_Body
C_WhiteBody = open < close
C_BlackBody = open > close
C_Range = high-low
C_IsInsideBar = C_BodyHi[1] > C_BodyHi and C_BodyLo[1] < C_BodyLo
C_BodyMiddle = C_Body / 2 + C_BodyLo
C_ShadowEquals = C_UpShadow == C_DnShadow or (math.abs(C_UpShadow - C_DnShadow) / C_DnShadow * 100) < C_ShadowEqualsPercent and (math.abs(C_DnShadow - C_UpShadow) / C_UpShadow * 100) < C_ShadowEqualsPercent
C_IsDojiBody = C_Range > 0 and C_Body <= C_Range * C_DojiBodyPercent / 100
C_Doji = C_IsDojiBody and C_ShadowEquals
  • These lines perform calculations to define various properties of each candlestick on the chart. They determine the high and low of the candlestick body, calculate the size of the upper and lower shadows, and identify if the candlestick is a Doji or has other specific characteristics.

Pattern Label Positioning

patternLabelPosLow = low - (ta.atr(30) * 0.6)
patternLabelPosHigh = high + (ta.atr(30) * 0.6)
  • These lines calculate the positions where labels indicating the pattern will be placed on the chart. patternLabelPosLow and patternLabelPosHigh are determined using the Average True Range (ATR), which helps in adjusting the label position relative to the current volatility of the asset.

User Inputs and Pattern Definition

label_color_bullish = input(color.rgb(30, 255, 49), "Label Color Bullish")
C_KickingBullishNumberOfCandles = 2
C_MarubozuShadowPercent = 5.0
C_Marubozu = C_LongBody and C_UpShadow <= C_MarubozuShadowPercent/100*C_Body and C_DnShadow <= C_MarubozuShadowPercent/100*C_Body
C_MarubozuWhiteBullishKicking = C_Marubozu and C_WhiteBody
C_MarubozuBlackBullish = C_Marubozu and C_BlackBody
C_KickingBullish = C_MarubozuBlackBullish[1] and C_MarubozuWhiteBullishKicking and high[1] < low
  • label_color_bullish: User input to choose the color of the label for bullish patterns.
  • C_KickingBullishNumberOfCandles: Defines the number of candles (2) to look back for identifying the pattern.
  • C_MarubozuShadowPercent: Sets a threshold for the shadow size to classify a candle as a Marubozu (a candlestick with little to no shadow).
  • C_Marubozu, C_MarubozuWhiteBullishKicking, C_MarubozuBlackBullish: Define Marubozu candlesticks and their role in forming the Bullish Kicking pattern.
  • C_KickingBullish: The main logic for the Bullish Kicking pattern detection. It checks for a bearish Marubozu followed by a bullish Marubozu with a gap up.

Alert and Labeling

alertcondition(C_KickingBullish, title = "New pattern detected", message = "New Kicking – Bullish pattern detected")
if C_KickingBullish
    var ttBullishKicking = "Kicking\nThe first day candlestick is a bearish marubozu candlestick with next to no upper or lower shadow and where the price opens at the day’s high and closes at the day’s low. The second day is a bullish marubozu pattern, with next to no upper or lower shadow and where the price opens at the day’s low and closes at the day’s high. Additionally, the second day gaps up extensively and opens above the opening price of the day before. This gap or window, as the Japanese call it, lies between day one and day two’s bullish candlesticks."
    label.new(bar_index, patternLabelPosLow, text="Kicking", style=label.style_label_up, color = label_color_bullish, textcolor=color.rgb(0, 0, 0), tooltip = ttBullishKicking)
  • alertcondition(...): Sets up an alert condition for the Bullish Kicking pattern detection.
  • if C_KickingBullish: This conditional statement checks if the Bullish Kicking pattern is identified on the current candlestick.
  • var ttBullishKicking: A variable holding the tooltip text describing the Bullish Kicking pattern. This text will be displayed when a user hovers over the label on the chart.
  • label.new(...): Creates a new label on the chart at patternLabelPosLow (calculated earlier) with the text “Kicking”. The label’s style, color, text color, and tooltip text are defined here.

Background Coloring

bgcolor(ta.highest(C_KickingBullish?1:0, C_KickingBullishNumberOfCandles)!=0 ? color.new(#21f360, 90) : na, offset=-(C_KickingBullishNumberOfCandles-1))
  • bgcolor(...): Changes the background color of the chart to visually indicate the presence of the Bullish Kicking pattern.
  • ta.highest(...): Checks if the Bullish Kicking pattern has occurred within the last C_KickingBullishNumberOfCandles candles.
  • color.new(#21f360, 90): If the pattern is found, the background color is set to a semi-transparent green, indicating a bullish signal. If not, no background color is applied (na).

Frequently Asked Questions

What does this Pine Script code do?

It detects the Bullish Kicking Candlestick Pattern, indicating potential bullish reversals in the market.

Can I use this script on different timeframes and assets?

Yes, the script is versatile and can be applied to various timeframes and financial instruments, including stocks and forex.

How does the script visually signify the Bullish Kicking pattern on a chart?

It marks the pattern with labels and changes the background color to green for easy identification.

Is it possible to adjust the detection sensitivity of the script?

Yes, the script includes configurable parameters, allowing users to tailor its sensitivity to their trading style.

Does the script provide real-time alerts for pattern formation?

Yes, it features an alert condition that notifies users when the Bullish Kicking pattern is detected.

Conclusion

This Pine Script code identifies the Bullish Kicking Candlestick Pattern, a key indicator of potential bullish market reversals. Designed for flexibility, it can be applied across various financial instruments and timeframes, making it a versatile tool for traders. With customizable parameters, the script allows for tailored sensitivity, catering to different trading styles. Visual cues and alert functionality enhance its practicality, providing clear and timely indications for traders. This script is an invaluable addition to the technical analyst’s toolkit, offering precision and adaptability in identifying significant market trend changes.

Leave a Comment