The Pin Bar Algorithm identifies high-probability rejection candles—also known as hammers, shooting stars, or pin bars—that signal failed attempts to push price in one direction. These patterns represent aggressive rejection of price levels and often precede significant reversals.

Quick Facts:
The Pin Bar Algorithm identifies high-probability rejection candles—also known as hammers, shooting stars, or pin bars—that signal failed attempts to push price in one direction. These patterns represent aggressive rejection of price levels and often precede significant reversals.
A pin bar is characterized by a small real body with a long rejection wick pointing in the direction of the failed move. The algorithm uses precise geometric ratios to identify valid pin bars while filtering out weak formations.
GEOMETRIC ANALYSIS Each candle is analyzed for pin bar characteristics:
BULLISH PIN BAR (Hammer) DETECTION Signals rejection of lower prices:
BEARISH PIN BAR (Shooting Star) DETECTION Signals rejection of higher prices:
BODY POSITION VALIDATION Ensures the body is positioned correctly:
NOSE CONTROL The "nose" is the wick opposite the rejection wick:
LONG SIGNAL (Bullish Pin Bar): ✅ Long lower wick (rejection of lower prices) ✅ Small upper wick (no resistance above) ✅ Body in upper portion of candle ✅ Minimum ATR-based size requirement met ✅ Trend filter bullish (if enabled) ✅ VMAlgo confirmation (if enabled)
SHORT SIGNAL (Bearish Pin Bar): ✅ Long upper wick (rejection of higher prices) ✅ Small lower wick (no support below) ✅ Body in lower portion of candle ✅ Minimum ATR-based size requirement met ✅ Trend filter bearish (if enabled) ✅ VMAlgo confirmation (if enabled)
GEOMETRIC RATIOS:
TREND FILTER:
VMALGO INTEGRATION:
✅ KEY LEVEL REJECTIONS at horizontal support/resistance ✅ MOVING AVERAGE BOUNCES (21 EMA, 50 SMA, 200 SMA) ✅ FIBONACCI LEVEL REJECTIONS (38.2%, 50%, 61.8%) ✅ TREND CONTINUATION pullback entries ✅ REVERSAL CONFIRMATION at market structure points
FOR CLASSIC PIN BARS: • wickToBodyRatio = 2.5-3.0 • maxNoseRatio = 0.25-0.3 • bodyPositionPct = 25-30 • Enable trend filter
FOR RELAXED DETECTION: • wickToBodyRatio = 1.5-2.0 • maxNoseRatio = 0.5-0.7 • bodyPositionPct = 35-40 • Use VMAlgo confirmation instead of strict geometry
FOR KEY LEVEL TRADING: • Combine with horizontal S/R levels • Increase minRangeATR to 0.7-1.0 • Require trend alignment • Consider higher timeframes (4H, Daily)
Subscribe to Pattern-Based or higher to access
Own the complete Pine Script source code forever. Modify, customize, and use it on your own TradingView account.
What you get with source code:
We use cookies to enhance your browsing experience, analyze site traffic, and personalize content. By clicking "Accept All", you consent to our use of cookies. Read our Privacy Policy for more information.