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
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.