OPEN-SOURCE SCRIPT
تم تحديثه

Advanced Candlestick Pattern Detector

114
What Does This Indicator Do?
This indicator looks at the way price moves in the market using candlesticks (those red and green bars you see on charts). It tries to find special patterns like Bullish Engulfing, Hammer, Doji, and others. When one of these patterns shows up, the indicator checks a bunch of filters to decide if the pattern is strong enough to be a signal to buy or sell.

The Main Parts of the Indicator

1. Candlestick Pattern Detection

Bullish Engulfing:
Imagine you see a small down candle (red) and then a big up candle (green) that completely “covers” the red one. That’s a bullish engulfing pattern. It can signal that buyers are taking over.

Bearish Engulfing:
The opposite of bullish engulfing. A small up candle (green) is followed by a big down candle (red) that covers the previous candle. This suggests sellers might be in control.

Hammer & Shooting Star:
Hammer: A candle with a very short body and a long shadow at the bottom. It shows that buyers stepped in after a drop.

Shooting Star:
Similar to the hammer but with a long shadow on top. It can indicate that sellers are starting to push the price down.

Doji:
A candle with almost no body. This means the opening and closing prices are very close. It shows indecision in the market.

Harami Patterns (Bullish & Bearish):
These are two-candle patterns where the second candle is completely inside the body of the first candle. They signal that the previous trend might be about to change.

Morning Star & Evening Star:
These are three-candle patterns.

Morning Star:
Often seen at the bottom of a downtrend, it can signal a reversal to an uptrend.

Evening Star:
Seen at the top of an uptrend, it can signal that the price may soon go down.

2. Filters: Making the Signals Smarter

The indicator doesn’t just rely on patterns. It uses several “filters” to decide if a pattern is strong enough to trade on. Here’s what each filter does:

a. Adaptive Thresholds (ATR-Based)

What It Is:
The indicator uses something called ATR (Average True Range) to see how much the price is moving (volatility).

How It Works:
Instead of using fixed numbers to decide if a candle is a Hammer or a Doji, it adjusts these numbers based on current market activity.

User Settings:
Use Adaptive Thresholds: Turn this on to let the indicator adjust automatically.
Body Factor, Shadow Factor, Doji Factor: These numbers are multipliers that decide how small or big the body and shadows of the candle should be. You can change them if you want the indicator to be more or less sensitive.

b. Volume Filter

What It Is:
Volume shows how many trades are happening.

How It Works:
The filter checks if the current volume is higher than the average volume (multiplied by a set factor). This helps ensure that the signal isn’t coming from a very quiet market.

User Settings:
Use Volume Filter: Turn this on if you want to ignore signals when there’s not much trading.

Volume MA Period & Volume Multiplier: These settings determine what “normal” volume is and how much higher the current volume must be to count.

c. Multi-Timeframe Trend Filter

What It Is:
This filter looks at a bigger picture by using a moving average (MA) from a higher timeframe (for example, daily charts).

How It Works:
For a bullish (buy) signal, the indicator checks if the price is above this MA.
For a bearish (sell) signal, the price must be below the MA.

User Settings:
Use Multi-Timeframe Trend Filter: Enable or disable this filter.
Higher Timeframe for Trend: Choose which timeframe (like Daily) to use.
Trend MA Type (SMA or EMA) & Trend MA Period: Choose the type of moving average and how many candles to average.

d. Additional Trend Filters (ADX & RSI)

ADX Filter:
What It Is:
ADX stands for Average Directional Index. It measures how strong a trend is.

How It Works:
If the ADX is above a certain threshold, it means the trend is strong.

User Setting:
ADX Threshold: Set the minimum strength the trend should have.

RSI Filter:
What It Is:
RSI (Relative Strength Index) tells you if the price is overbought (too high) or oversold (too low).

How It Works:
For a buy signal, RSI should be low (under a set threshold).
For a sell signal, RSI should be high (above a set threshold).

User Settings:
RSI Buy Threshold & RSI Sell Threshold: These set the levels for buying or selling.

3. How the Final Signal Is Determined

For a signal (buy or sell) to be generated, the indicator first checks if one of the candlestick patterns is present. Then it goes through all these filters (trend, volume, ADX, RSI). Only if everything is in line will it show:

A BUY signal when all bullish conditions are met.
A SELL signal when all bearish conditions are met.

4. Visual Elements on the Chart

Trend MA Line:
A blue line is drawn on your chart showing the moving average from the higher timeframe (if you enable the trend filter). This helps you see the overall direction of the market.

Labels on the Chart:
When a signal is detected, you’ll see:

A BUY label below the candle (green).
A SELL label above the candle (red).

Background Colors:
The chart background might change slightly (green for bullish and red for bearish) to give you a quick visual cue.

Histogram:
At the bottom, there is a histogram that shows +1 for bullish signals, -1 for bearish signals, and 0 when there’s no clear signal.

5. Alerts
Alerts are built into the indicator so you can get a notification when a signal appears. The alert messages are fixed strings, meaning they always say something like “BUY signal on [ticker] at price [close].” You can set up these alerts in TradingView to be notified via sound, email, or pop-up.

How to Use and Adjust the Filters

Deciding on Patterns:
You can choose which candlestick patterns you want to detect by toggling the options (e.g., Bullish Engulfing, Hammer, etc.).

Adjusting Adaptive Thresholds:
If you feel that the indicator is too sensitive (or not sensitive enough) during volatile times, adjust the Body Factor, Shadow Factor, and Doji Factor. These change how the indicator recognizes different candle shapes based on market movement.

Volume Filter Settings:

Use Volume Filter:
Turn this on if you want to ignore signals when there’s not enough trading activity.
Adjust the Volume MA Period and Volume Multiplier to change what “normal” volume is for your chart.

Multi-Timeframe Trend Filter Settings:
Choose a higher timeframe (like Daily) to see the bigger picture trend. Select the type of moving average (SMA or EMA) and its period. This filter ensures you only trade in the direction of the overall trend.

ADX & RSI Filters:

ADX:
Adjust the ADX Threshold if you want to change the minimum strength of the trend needed for a signal.

RSI:
Set the RSI Buy Threshold (for oversold conditions) and RSI Sell Threshold (for overbought conditions) to refine when a signal is valid.

Summary
This indicator is like having a smart assistant that not only looks for specific price patterns (candlesticks) but also checks if the overall market conditions are right using several filters. By combining:

  • Pattern Detection

  • Adaptive thresholds (based on ATR)

  • Volume Checks

  • Multi-Timeframe Trend Analysis

  • Additional Trend Strength and Overbought/Oversold Indicators (ADX & RSI)


...it helps you decide if it might be a good time to buy or sell. You can customize each part to fit your trading style, and with the built-in alerts, you can be notified when everything lines up.

Feel free to adjust the settings to see how each filter changes the signals on your chart. Experimenting with these will help you learn how the market behaves and how you can best use the indicator for your own strategy!

ملاحظات الأخبار
This version will only display the signals directly on your chart without any extra window or histogram.
ملاحظات الأخبار
Clean chart only.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.