Home » Candlestick Patterns » Detecting Tweezer Top Candlestick Pattern in Pine Script

Detecting Tweezer Top Candlestick Pattern in Pine Script

Photo of author
Published on

Overview of Tweezer Top Candlestick Pattern

The Tweezer Top candlestick pattern is a prominent bearish reversal indicator, commonly identified at the pinnacle of an uptrend in price charts. It is characterized by two adjacent candlesticks that share almost identical high points, visually creating a level line appearance at the top. This pattern is a crucial signal for traders and analysts, as it typically suggests a potential reversal from a bullish to a bearish market trend. The alignment of high prices in both candlesticks is a key feature, signifying a strong resistance level where the market’s bullish momentum may be waning and bearish sentiment is poised to take over. Key features include

Tweezer Top
  1. Formation: It comprises two adjacent candlesticks.
  2. High Price Alignment: Both candlesticks have almost the same high point, creating a level appearance at the top.
  3. Trend Context: Usually appears at the end of an uptrend, indicating a potential reversal.
  4. Bearish Signal: Suggests a shift from bullish to bearish market sentiment.
  5. Candlestick Colors: The first candle is generally bullish (green or white), and the second can be either bullish or bearish, often bearish (red or black).
  6. Market Psychology: Indicates that bulls are losing control and bears are starting to dominate, setting a resistance level.

Importance in Technical Analysis


The Tweezer Top candlestick pattern holds significant importance in technical analysis for several reasons:

  1. Bearish Reversal Signal: It’s a reliable indicator of a potential reversal from a bullish to a bearish trend, particularly useful after a sustained uptrend.
  2. Market Sentiment Insight: This pattern reflects a shift in market sentiment, where bullish momentum is waning and bears are starting to gain control, often leading to a price decline.
  3. Resistance Level Identification: The Tweezer Top highlights strong resistance levels where prices have struggled to move higher, indicating a possible ceiling for the current trend.
  4. Confirmation Tool: It’s often used in combination with other technical indicators and analysis tools for confirming trend reversals, thereby enhancing trading strategies.
  5. Risk Management: Identifying Tweezer Tops can help traders in setting stop-loss orders or adjusting positions to manage risk in anticipation of a potential market downturn.

Example From Trading View

Example From Trading View

Defining the Tweezer Top Candlestick Pattern Criteria 

The Tweezer Top candlestick pattern is defined by specific criteria that help in identifying this bearish reversal signal. Here are the key criteria:

  1. Two Adjacent Candlesticks: The pattern consists of two candlesticks that are side-by-side.
  2. Similar Highs: Both candlesticks have almost the same high points. This similarity in highs is the defining feature of the Tweezer Top.
  3. First Candle Bullish: The first candle in the pattern is typically bullish, indicating an uptrend or a rise in prices.
  4. Second Candle Color: The second candle can be bullish or bearish, but it often is bearish (red or black), which strengthens the reversal signal.
  5. Trend Precedence: The pattern should appear after a notable uptrend in the market. Its significance is heightened when it forms at the peak of an extended bullish phase.
  6. Volume Consideration: Ideally, the formation of a Tweezer Top should be accompanied by an increase in trading volume, especially during the second candlestick, for added confirmation.
  7. Resistance Level: The similar highs of the Tweezer Top pattern often form a resistance level, suggesting that the market is struggling to push prices higher.

Code For Detecting Tweezer Top

//@version=5
indicator("Tweezer Top Detector", overlay=true)

// Function to check for Tweezer Top pattern
isTweezerTop() =>
    // Define the candles
    high1 = high[1]
    high0 = high
    close1 = close[1]
    open1 = open[1]
    // Check if the first candle is bullish and both highs are the same
    firstCandleBullish = close1 > open1
    similarHigh = high1 == high0
    firstCandleBullish and similarHigh

// Using labels to indicate the Tweezer Top pattern
if isTweezerTop()
    label.new(bar_index, high, "Tweezer Top", style=label.style_label_down, color=color.red, textcolor=color.white, yloc=yloc.abovebar)

Output

Output

Overview of the script 

1. Script Initialization

//@version=5
indicator("Tweezer Top Detector", overlay=true)
  • //@version=5: This specifies that the script is using version 5 of Pine Script, the latest version with the most advanced features and syntax.
  • indicator("Tweezer Top Detector", overlay=true): This line sets up the script as an indicator called “Tweezer Top Detector” and ensures it overlays on top of the price chart (not in a separate window).

2. Function Definition for Pattern Detection

isTweezerTop() =>
  • isTweezerTop() =>: This defines a function named isTweezerTop which contains the logic to identify the Tweezer Top pattern.

3. Defining Candlestick Variables:

   high1 = high[1]
    high0 = high
    close1 = close[1]
    open1 = open[1]
  • firstCandleBullish = close1 > open1: This checks if the first candle (previous candle) is bullish, meaning its closing price is higher than its opening price.
  • similarHigh = high1 == high0: This checks if the high prices of the current and previous candles are the same, a key feature of the Tweezer Top pattern.
  • The final condition firstCandleBullish and similarHigh ensures that both criteria (bullish first candle and similar highs) must be met for the pattern to be identified.

4. Pattern Identification Criteria

    firstCandleBullish = close1 > open1
    similarHigh = high1 == high0
    firstCandleBullish and similarHigh
  • firstCandleBullish = close1 > open1: This checks if the first candle (previous candle) is bullish, meaning its closing price is higher than its opening price.
  • similarHigh = high1 == high0: This checks if the high prices of the current and previous candles are the same, a key feature of the Tweezer Top pattern.
  • The final condition firstCandleBullish and similarHigh ensures that both criteria (bullish first candle and similar highs) must be met for the pattern to be identified.

5. Labeling the Pattern on the Chart

if isTweezerTop()
    label.new(bar_index, high, "Tweezer Top", style=label.style_label_down, color=color.red, textcolor=color.white, yloc=yloc.abovebar)
  • The if isTweezerTop() condition checks each candle to see if the Tweezer Top criteria are met.
  • label.new(...): This function creates a new label on the chart. It places a label at the bar index (bar_index) and high price (high) of the current candle, with the text “Tweezer Top”. The label is styled to point downwards (style=label.style_label_down), colored red with white text, and positioned above the bar (yloc=yloc.abovebar).

Frequently Asked Questions

How does the script identify a Tweezer Top pattern?

Absolutely, it’s suitable for stocks, forex, commodities, and other traded instruments.

Does the script indicate the strength of the Tweezer Top signal?

No, it only identifies the pattern; strength and context should be assessed separately.

Will the script work for different market instruments?

Absolutely, it’s suitable for stocks, forex, commodities, and other traded instruments.

What is the purpose of the “Tweezer Top Detector” script?

It detects and labels Tweezer Top patterns on charts, indicating potential bearish reversals.

Can this script be used on any time frame?

Yes, it’s applicable to all time frames, but the pattern’s significance may vary.

Conclusion

In conclusion, the “Tweezer Top Detector” Pine Script is a valuable tool for traders who rely on technical analysis. By automating the detection of Tweezer Top patterns, this script simplifies the identification of potential bearish reversals. Its versatility across different time frames and market instruments makes it a flexible addition to a trader’s toolkit. While it effectively highlights these patterns, traders are reminded that it should be used in conjunction with other analysis methods and indicators to gauge the strength and context of the signal for more informed trading decisions. 

Leave a Comment