Home » Candlestick Patterns » Detecting Rising Three Methods Candlestick Pattern in Pine Script

Detecting Rising Three Methods Candlestick Pattern in Pine Script

Photo of author
Published on

Overview of Rising Three Methods Candlestick Pattern

The Rising Three Methods is a bullish continuation candlestick pattern, typically occurring in an uptrend and suggests that the prevailing trend is likely to continue. It’s a five-candlestick pattern with distinct characteristics:

Rising Three Methods Candlestick Pattern
  1. Formation:
    • The pattern begins with a long bullish candle.
    • It is followed by three smaller bearish candles, each contained within the range of the first bullish candle. These candles represent a brief consolidation or pullback in the market.
    • The fifth candle is a long bullish candle that closes above the close of the first candle, confirming the continuation of the uptrend.

Importance in Technical Analysis

The Rising Three Methods candlestick pattern holds significant importance in technical analysis for several reasons:

  1. Confirmation of Trend Continuity: It serves as a strong confirmation of the continuation of an existing uptrend. This is particularly useful in distinguishing between a temporary pullback and a potential trend reversal.
  2. Reliability: As a five-candle pattern, the Rising Three Methods tends to be more reliable than patterns with fewer candles. Its distinct formation reduces the likelihood of false signals compared to simpler patterns.
  3. Risk Management: By signaling the continuation of an uptrend, this pattern helps traders in managing their risk. Traders might use this pattern to place stop-loss orders or to decide the timing for taking profits.
  4. Trading Strategy: It can be an effective tool for traders looking to enter long positions or add to existing ones. The pattern suggests that after a brief consolidation, the upward trend is likely to resume, providing a strategic entry point.
  5. Volume Analysis: The pattern is often accompanied by an increase in volume, especially on the last bullish candle, adding to its credibility. Volume analysis in conjunction with this pattern can provide a more comprehensive view of market sentiment.

Example From Trading View

This image has an empty alt attribute; its file name is EURJPY_2024-01-08_21-40-16_52704-1024x759.png

Defining the Rising Three Methods Candlestick Pattern Criteria 

The Rising Three Methods is a specific and reliable candlestick pattern in technical analysis, characterized by a set of criteria that defines its structure. Here are the key criteria for identifying this pattern:

  1. Prevailing Trend: The pattern must occur within the context of an existing uptrend. This is crucial as the pattern is a continuation signal, indicating that the existing bullish trend is likely to persist.
  2. First Candle: The pattern begins with a long bullish (upward) candlestick. This candle should have a significantly large body, indicating strong buying pressure and reinforcing the existing uptrend.
  3. Middle Three Candles: Following the first candle are three smaller bearish (downward) candlesticks. Each of these candles should:
    • Open within the body of the previous candle.
    • Close lower than it opened, but still within the range of the first candle.
    • Be noticeably smaller compared to the first candle, indicating a mild retracement or consolidation rather than a reversal.
  4. Fifth Candle: The final candle in the pattern is another long bullish candlestick. It should:
    • Close above the close of the first candle.
    • Ideally, have a body that is as large as or larger than the first candle, reaffirming the strength of the bullish trend.

Code For Rising Three Methods

//@version=5
indicator("Rising Three Methods", overlay=true)

C_DownTrend = true
C_UpTrend = true
var trendRule1 = "SMA50"
var trendRule2 = "SMA50, SMA200"
var trendRule = input.string(trendRule1, "Detect Trend Based On", options=[trendRule1, trendRule2, "No detection"])

if trendRule == trendRule1
	priceAvg = ta.sma(close, 50)
	C_DownTrend := close < priceAvg
	C_UpTrend := close > priceAvg

if trendRule == trendRule2
	sma200 = ta.sma(close, 200)
	sma50 = ta.sma(close, 50)
	C_DownTrend := close < sma50 and sma50 < sma200
	C_UpTrend := close > sma50 and sma50 > sma200
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.blue, "Label Color Bullish")
C_RisingThreeMethodsBullishNumberOfCandles = 5
C_RisingThreeMethodsBullish = false
if C_UpTrend[4] and (C_LongBody[4] and C_WhiteBody[4]) and (C_SmallBody[3] and C_BlackBody[3] and open[3]<high[4] and close[3]>low[4]) and (C_SmallBody[2] and C_BlackBody[2] and open[2]<high[4] and close[2]>low[4]) and (C_SmallBody[1] and C_BlackBody[1] and open[1]<high[4] and close[1]>low[4]) and (C_LongBody and C_WhiteBody and close>close[4])
	C_RisingThreeMethodsBullish := true
alertcondition(C_RisingThreeMethodsBullish, title = "New pattern detected", message = "New Rising Three Methods – Bullish pattern detected")
if C_RisingThreeMethodsBullish
    var ttBullishRisingThreeMethods = "Rising Three Methods\nRising Three Methods is a five-candle bullish pattern that signifies a continuation of an existing uptrend. The first candle is long and green, followed by three short red candles with bodies inside the range of the first candle. The last candle is also green and long and it closes above the close of the first candle. This decisive fifth strongly bullish candle hints that bears could not reverse the prior uptrend and that bulls have regained control of the market."
    label.new(bar_index, patternLabelPosLow, text="Rising Three Methods", style=label.style_label_up, color = label_color_bullish, textcolor=color.white, tooltip = ttBullishRisingThreeMethods)
bgcolor(ta.highest(C_RisingThreeMethodsBullish?1:0, C_RisingThreeMethodsBullishNumberOfCandles)!=0 ? color.new(color.blue, 90) : na, offset=-(C_RisingThreeMethodsBullishNumberOfCandles-1))

Output

Overview of the script 

1. Script Initialization

//@version=5
indicator("Rising Three Methods", overlay=true)
  • Declares the version of Pine Script (version 5).
  • Sets up an indicator titled “Rising Three Methods” that overlays on the main chart.

2. Trend Determination Setup

var trendRule1 = "SMA50"
var trendRule2 = "SMA50, SMA200"
var trendRule = input.string(trendRule1, "Detect Trend Based On", options=[trendRule1, trendRule2, "No detection"])
  • Allows users to choose the method for trend detection: either a single 50-period SMA, a combination of 50 and 200-period SMAs, or no trend detection.

3. Trend Calculation

if trendRule == trendRule1
    priceAvg = ta.sma(close, 50)
    C_UpTrend := close > priceAvg
if trendRule == trendRule2
    sma200 = ta.sma(close, 200)
    sma50 = ta.sma(close, 50)
    C_UpTrend := close > sma50 and sma50 > sma200
  • This code snippet allows users to select their preferred method for trend detection, providing flexibility in the analysis.
  • There are two options for trend detection, depending on the user’s choice:
    • Option 1: Single Moving Average (SMA) Trend Detection (trendRule1)
      • In this option, a 50-period Simple Moving Average (SMA) is calculated based on the closing prices of the asset.
      • priceAvg represents the value of the SMA at each point in the chart.
      • C_UpTrend is a boolean variable that is set to true when the closing price is greater than the calculated SMA, indicating an uptrend.
    • Option 2: Combined Moving Averages Trend Detection (trendRule2)
      • This option involves the calculation of two SMAs: a 50-period SMA (sma50) and a 200-period SMA (sma200).
      • Similar to the first option, C_UpTrend is set to true when the closing price is greater than both SMAs, confirming an uptrend.

4. Candlestick Analysis Setup

C_Len = 14 // ta.ema depth for bodyAvg
C_WhiteBody = open < close
C_BlackBody = open > close
...
C_Range = high - low
  • Defines various parameters and calculations to analyze the characteristics of candlesticks, like body length and color.

5. Rising Three Methods Pattern Identification

C_RisingThreeMethodsBullishNumberOfCandles = 5
C_RisingThreeMethodsBullish = false
if C_UpTrend[4] and (C_LongBody[4] and C_WhiteBody[4]) and ...
    C_RisingThreeMethodsBullish := true

Checks for a sequence of five specific candles to identify the Rising Three Methods pattern:

  • A long bullish candle, followed by three smaller bearish candles, and another long bullish candle.

6. Pattern Alert and Visualization

alertcondition(C_RisingThreeMethodsBullish, title = "New pattern detected", message = "New Rising Three Methods – Bullish pattern detected")
if C_RisingThreeMethodsBullish
    label.new(bar_index, patternLabelPosLow, text="Rising Three Methods", style=label.style_label_up, color = label_color_bullish, textcolor=color.white, tooltip = ttBullishRisingThreeMethods)
  • Sets up an alert condition for when the Rising Three Methods pattern is identified.
  • Adds a label on the chart for easy visualization of the pattern.

7. Background Coloring

bgcolor(ta.highest(C_RisingThreeMethodsBullish?1:0, C_RisingThreeMethodsBullishNumberOfCandles)!=0 ? color.new(color.blue, 90) : na, offset=-(C_RisingThreeMethodsBullishNumberOfCandles-1))
  • Changes the background color of the chart where the pattern is identified, enhancing the visibility of the pattern.

Frequently Asked Questions

What is the purpose of this Pine Script code?

This Pine Script is designed to identify the Rising Three Methods candlestick pattern on financial charts. It helps traders spot a specific bullish continuation pattern within an existing uptrend.

How does the script determine the prevailing trend?

The script offers two options for trend detection: a single 50-period Simple Moving Average (SMA) or a combination of a 50-period SMA and a 200-period SMA. Users can choose their preferred method to identify the trend.

What are the key characteristics of the Rising Three Methods pattern that the script looks for?

The script identifies the Rising Three Methods pattern based on a sequence of five candles: a long bullish candle followed by three smaller bearish candles and another long bullish candle. These candles should have specific open, close, and body characteristics.

How does the script visualize the pattern on the chart?

While the script is a valuable tool for identifying the Rising Three Methods pattern, it is recommended to use it in conjunction with other technical analysis tools and strategies. Traders should conduct a comprehensive analysis before making trading decisions.

Conclusion

The Pine Script provided in this article identifies the Rising Three Methods candlestick pattern within financial charts. This pattern, characterized by a sequence of five candles, is a bullish continuation signal that can aid in making informed trading decisions. The script offers flexibility by allowing users to choose between two trend detection methods, either a single 50-period Simple Moving Average (SMA) or a combination of a 50-period SMA and a 200-period SMA. This choice empowers traders to adapt the script to their specific trading strategies and preferences.

Leave a Comment