Home » Candlestick Patterns » Detecting Matching Low Candlestick Pattern in Pine Script

Detecting Matching Low Candlestick Pattern in Pine Script

Photo of author
Published on

Overview of Matching Low Candlestick Pattern

The Matching Low Candlestick Pattern is a bullish reversal pattern that appears in downtrends and is considered a signal for a potential change in the market direction from bearish to bullish. This pattern is composed of two candles and is relatively simple to identify. Here’s an overview of its key characteristics:

Overview of Matching Low Candlestick Pattern
  1. Appearance in a Downtrend: The Matching Low pattern typically forms during a downtrend, indicating potential exhaustion of the bearish momentum.
  2. Composition of Two Candles:
    • First Candle: The first candle in the pattern is a long black (or red) candle, indicating a strong bearish sentiment. It’s characterized by a significant difference between the opening and closing prices, with the close being much lower than the open.
    • Second Candle: The second candle is also black. What’s crucial in this candle is its closing price, which should be almost the same as the closing price of the first candle. The lengths of the shadows (the lines extending from the top or bottom of the body) can vary, but they are not the primary focus of this pattern.

Importance in Technical Analysis

In technical analysis, candlestick patterns like the Matching Low Candlestick Pattern hold significant importance due to their ability to provide insights into market psychology and potential future price movements.

  1. Indication of Market Sentiment: Candlestick patterns are a visual representation of market sentiment over a specific period. The Matching Low pattern, with its two consecutive black candles closing at nearly the same price, indicates a potential shift in sentiment from bearish to bullish.
  2. Predictive Value: While no pattern guarantees future price movements, patterns like the Matching Low can offer predictive insights. They suggest that the selling pressure is waning and a bullish reversal might be on the horizon, which can be valuable information for traders and investors.
  3. Timing of Entries and Exits: For traders looking to optimize entry and exit points, candlestick patterns can be crucial. The Matching Low pattern can signal a good entry point for a long position or an exit point for a short position, especially when confirmed by other technical indicators.
  4. Risk Management: Understanding candlestick patterns aids in risk management. Recognizing a Matching Low pattern can help traders set more informed stop-loss orders and manage their positions more effectively, reducing potential losses.
  5. Enhancement of Other Analysis Methods: Candlestick patterns are often used in conjunction with other forms of technical analysis, such as trend lines, oscillators, and volume analysis. The Matching Low pattern can provide additional context and confirmation, enhancing the reliability of these other methods.

Example From Trading View

Example From Trading View

Defining the Matching Low Candlestick Pattern Criteria

The Advance Block Candlestick Pattern is defined by specific criteria that signal a potential bearish reversal within an uptrend. Here are the key criteria that characterize this pattern:

  1. Three-Candle Formation:
    • The pattern consists of three consecutive white (bullish) candles.
  2. Trend Context:
    • It typically appears within an established uptrend.
  3. Candle Color and Closing Prices:
    • Each candle in the sequence should have a white (bullish) real body, indicating that the closing price is higher than the opening price.
    • The closing price of each candle should be higher than the previous candle, reflecting the ongoing uptrend.

Code For Detecting Matching Low

//@version=5
indicator("Matching Low Candlestick Pattern", shorttitle="ML", overlay=true)

// Function to check if a candle is a long black candle
isLongBlackCandle(close, open, atr) =>
    close < open and (open - close) > atr * 0.5

// ATR for determining long candles
atrLength = 14
atr = ta.atr(atrLength)

// Criteria for Matching Low
firstCandleBlack = isLongBlackCandle(close[1], open[1], atr[1])
secondCandleBlack = isLongBlackCandle(close, open, atr)
closingPricesMatch = math.abs(close - close[1]) <= (atr * 0.1)

// Detecting the pattern
matchingLowPattern = firstCandleBlack and secondCandleBlack and closingPricesMatch

// Plotting the label
if matchingLowPattern
    label.new(bar_index, low, "Matching Low", color=color.red,yloc = yloc.abovebar)

Output

Output

Overview of the script 

1. Script Declaration

//@version=5
indicator("Matching Low Candlestick Pattern", shorttitle="ML", overlay=true)
  • //@version=5: This specifies that the script uses version 5 of Pine Script.
  • indicator(...): This function declares a new indicator. “Matching Low Candlestick Pattern” is the name displayed on the chart, “ML” is a short title for the indicator, and overlay=true means the indicator will be plotted on the main chart (overlaying the price).

2. Function to Check for a Long Black Candle

isLongBlackCandle(close, open, atr) =>
    close < open and (open - close) > atr * 0.5
  • This function, isLongBlackCandle, determines if a candle is a long black (bearish) candle. It takes three parameters: close, open, and atr (Average True Range).
  • close < open checks if the candle is black (closing price is lower than the opening price).
  • (open - close) > atr * 0.5 checks if the candle is “long” by comparing the size of the candle (open – close) to half the value of the ATR.

3. Setting Up ATR (Average True Range)

atrLength = 14
atr = ta.atr(atrLength)
  • atrLength = 14: This sets the length for the ATR calculation to 14 periods, a common setting for ATR.
  • atr = ta.atr(atrLength): This calculates the ATR using the specified length. The ATR is used to determine what constitutes a “long” candle.

4. Criteria for Matching Low Pattern

firstCandleBlack = isLongBlackCandle(close[1], open[1], atr[1])
secondCandleBlack = isLongBlackCandle(close, open, atr)
closingPricesMatch = math.abs(close - close[1]) <= (atr * 0.1)
  • firstCandleBlack and secondCandleBlack use the isLongBlackCandle function to check if the first and second candles (in a two-candle pattern) are long black candles.
  • close[1], open[1], atr[1] refer to the previous candle’s close, open, and ATR values.
  • closingPricesMatch checks if the closing prices of the two candles are approximately the same, within a tolerance defined as 10% of the ATR.

5. Detecting the Pattern

matchingLowPattern = firstCandleBlack and secondCandleBlack and closingPricesMatch
  • This line combines the previously defined conditions to identify the Matching Low pattern. The pattern is recognized when both candles are long black candles, and their closing prices are approximately the same.

6. Plotting the Label

if matchingLowPattern
    label.new(bar_index, low, "Matching Low", color=color.red,yloc = yloc.abovebar)
  • This conditional statement checks if the matchingLowPattern condition is true.
  • label.new(...): If the pattern is detected, this function plots a label on the chart.
  • bar_index is the current bar’s index (position on the x-axis).
  • low is the low price of the current bar, where the label will be positioned.
  • "Matching Low" is the text displayed in the label.
  • color=color.red sets the label’s color to red.
  • yloc = yloc.abovebar positions the label above the bar.

Frequently Asked Questions

What does the Matching Low Candlestick Pattern script identify?

The script detects a bullish reversal pattern consisting of two consecutive long black candles with similar closing prices.

How is a ‘long’ candle defined in this script?

A ‘long’ candle is defined as one where the difference between the open and close prices is greater than half the Average True Range (ATR).

What version of Pine Script is this code written for?

This code is written for Pine Script version 5.

Can the ATR period be adjusted in the script?

Yes, the ATR period can be adjusted. It’s set to 14 by default (atrLength = 14), but you can change this value.

Does the script provide visual indicators on the chart?

Yes, the script plots a red label above the bars where the Matching Low Candlestick Pattern is detected.

Conclusion

This script is designed to detect the Matching Low Candlestick Pattern. Specifically tailored for Pine Script version 5, it automates the identification of this bullish reversal signal, characterized by two consecutive long black candles with closely matching closing prices. The script not only streamlines market analysis by providing rapid and precise pattern recognition but also offers customization options, such as adjusting the Average True Range (ATR) length, to accommodate different trading preferences and asset volatilities. For enhanced clarity and ease of use, it visually marks the detected patterns on the trading chart, assisting traders in making well-informed trading decisions.

Leave a Comment