This script is designed to detect and alert for Pin Bars (candles with long wicks) on a chart in real time. Pin Bars are candlestick patterns that often indicate potential market reversals or continuations, depending on their structure (dominant upper or lower wick). In addition to detecting Pin Bars, the script manages alerts and plots key levels (the 50% level of the Pin Bar) on the chart.
2. User Parameters
The script allows users to customize several parameters to adjust Pin Bar detection and alert configurations: • Enabled Alerts: • Enable Bullish Pin Bar Alert: Activates alerts for bullish Pin Bars. • Enable Bearish Pin Bar Alert: Activates alerts for bearish Pin Bars. • Enable 50% Level Alert: Activates alerts when the 50% level of a Pin Bar is reached. • Detection Thresholds: • Wick Ratio Threshold: Ratio of the upper wick to the lower wick (defines the candlestick shape). • Body to Wick Multiplier: Multiplies the body size to exclude candles with a “nose.” • Largest Wick to Body Multiplier: Multiplies the body size to identify Pin Bars with a dominant wick. • Visual Customization: • Color and width of the line representing the 50% level of a Pin Bar. • Number of bars over which the 50% level line extends.
3. Detection Mechanism
The script uses a function (isPinBarByWickRatio) to evaluate if a candle meets the criteria for a Pin Bar: • Bullish Pin Bar: • The lower wick is significantly larger than the upper wick and the body. • The upper wick is non-existent or negligible. • Bearish Pin Bar: • The upper wick is significantly larger than the lower wick and the body. • The lower wick is non-existent or negligible.
The criteria include: • The ratio of the upper wick to the lower wick. • The size of the body relative to the dominant wick. • The comparison of the largest wick to the body size.
4. Alerts
The script defines three types of alerts: 1. Bullish Pin Bar Alert: Triggers when a bullish Pin Bar is detected. 2. Bearish Pin Bar Alert: Triggers when a bearish Pin Bar is detected. 3. 50% Level Touched: Triggers when the price reaches the 50% level of a previously detected Pin Bar.
5. Graphical Display
The script provides multiple visual elements for better understanding: • Candle Coloring: • Green for bullish Pin Bars. • Red for bearish Pin Bars. • Graphical Markers: • A green triangle above detected bullish bars. • A red triangle below detected bearish bars. • A blue circle when the 50% level is touched. • 50% Level Lines: • A horizontal line at 50% of the height of a detected Pin Bar. • The line extends for a user-defined number of bars.
6. Storage and Updates
The script keeps track of: • Index of the last detected Pin Bar. • 50% level of the last detected Pin Bar. • Type of the last detected Pin Bar (bullish or bearish).
These values are updated only when the bar is confirmed (at close).
7. Practical Use • This script is ideal for traders looking for reversal or continuation signals based on Pin Bar analysis. • Alerts enable traders to monitor opportunities without actively watching the chart. • The 50% lines help identify key support or resistance levels associated with Pin Bars.https://www.tradingview.com/x/dr0okyob/
Ten skrypt został opublikowany z zamkniętym kodem źródłowym i możesz z niego dowolnie korzystać. Możesz go dodać do ulubionych, żeby używać go na wykresie. Nie możesz przeglądać ani modyfikować jego kodu źródłowego.
Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.