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
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน