OPEN-SOURCE SCRIPT
LETHINH Pinbar

📌 PinBar Minimal Detector — Description (English)
PinBar Minimal Detector is a clean and efficient tool designed to detect high-quality pin bars based purely on candle geometry.
This script focuses on the core characteristics of a true pin bar: a long rejection wick and a small candle body, without adding unnecessary complexity. It is ideal for traders who want fast, reliable signal detection without noise.
⸻
✨ Key Features
• Detects both bullish and bearish pin bars.
• Fully configurable wick/body ratio.
• Optional filter for maximum opposite wick size.
• Option to ignore candles with extremely small bodies.
• Clean chart display with simple labels (“PIN”).
• Includes alert conditions for automated notifications (webhook, popup, email, etc.).
• Lightweight and optimized for fast execution on any timeframe.
⸻
🔍 Detection Logic
A candle qualifies as a bullish pin bar when:
• The lower wick is at least X times larger than the body.
• The upper wick is relatively small (optional filter).
• The body is above the minimum body threshold.
A candle qualifies as a bearish pin bar when:
• The upper wick is at least X times larger than the body.
• The lower wick is relatively small.
• The body meets the minimum size requirement.
This ensures that only candles showing strong rejection are highlighted.
⸻
⚙️ Input Parameters
1. wick/body ratio
Defines how many times longer the main wick must be compared to the candle body.
For example:
• 3.0 → wick must be at least 3× the body
• 4.0–5.0 → only very strong pin bars
2. opposite wick max (factor)
The maximum allowed size of the wick on the opposite side, relative to the body.
Example:
• 0.5 → opposite wick ≤ 50% of body
• Lower values = stricter filtering
3. min body px
Filters out candles with bodies that are too small (low volatility candles).
4. show labels
Enable or disable the “PIN” labels on the chart.
⸻
🚨 Alerts
The script includes two built-in alert conditions:
• Bullish PinBar Detected
• Bearish PinBar Detected
These alerts can be paired with:
• TradingView notifications
• Webhooks (for bots / automation)
• Email or SMS alerts
⸻
🎯 Use Cases
• Identify high-probability reversal points
• Enhance price action strategies
• Combine with S/R zones, supply & demand, trendlines, or order blocks
• Filter entries on lower timeframes while following higher-timeframe trend bias
⸻
📘 Notes
This is a minimalistic version by design.
If you want a more advanced version (confirmation candle, volume filter, multi-timeframe filtering, trend direction filtering, etc.), this script can be expanded easily
PinBar Minimal Detector is a clean and efficient tool designed to detect high-quality pin bars based purely on candle geometry.
This script focuses on the core characteristics of a true pin bar: a long rejection wick and a small candle body, without adding unnecessary complexity. It is ideal for traders who want fast, reliable signal detection without noise.
⸻
✨ Key Features
• Detects both bullish and bearish pin bars.
• Fully configurable wick/body ratio.
• Optional filter for maximum opposite wick size.
• Option to ignore candles with extremely small bodies.
• Clean chart display with simple labels (“PIN”).
• Includes alert conditions for automated notifications (webhook, popup, email, etc.).
• Lightweight and optimized for fast execution on any timeframe.
⸻
🔍 Detection Logic
A candle qualifies as a bullish pin bar when:
• The lower wick is at least X times larger than the body.
• The upper wick is relatively small (optional filter).
• The body is above the minimum body threshold.
A candle qualifies as a bearish pin bar when:
• The upper wick is at least X times larger than the body.
• The lower wick is relatively small.
• The body meets the minimum size requirement.
This ensures that only candles showing strong rejection are highlighted.
⸻
⚙️ Input Parameters
1. wick/body ratio
Defines how many times longer the main wick must be compared to the candle body.
For example:
• 3.0 → wick must be at least 3× the body
• 4.0–5.0 → only very strong pin bars
2. opposite wick max (factor)
The maximum allowed size of the wick on the opposite side, relative to the body.
Example:
• 0.5 → opposite wick ≤ 50% of body
• Lower values = stricter filtering
3. min body px
Filters out candles with bodies that are too small (low volatility candles).
4. show labels
Enable or disable the “PIN” labels on the chart.
⸻
🚨 Alerts
The script includes two built-in alert conditions:
• Bullish PinBar Detected
• Bearish PinBar Detected
These alerts can be paired with:
• TradingView notifications
• Webhooks (for bots / automation)
• Email or SMS alerts
⸻
🎯 Use Cases
• Identify high-probability reversal points
• Enhance price action strategies
• Combine with S/R zones, supply & demand, trendlines, or order blocks
• Filter entries on lower timeframes while following higher-timeframe trend bias
⸻
📘 Notes
This is a minimalistic version by design.
If you want a more advanced version (confirmation candle, volume filter, multi-timeframe filtering, trend direction filtering, etc.), this script can be expanded easily
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.