Pin Bar Detector [SSFX]Pin Bar Detector is an indicator designed to automatically identify Bullish Pin Bars and Bearish Pin Bars directly on the chart based on candle structure and wick proportions. It is built for price action traders who want a fast and objective way to spot rejection candles without manually checking every bar.
The script evaluates each candle using three main components:
Body size relative to the full candle range
Main wick size
Opposite wick size
For a Bullish Pin Bar, the indicator looks for candles with:
a small body
a long lower wick
a small upper wick
For a Bearish Pin Bar, the indicator looks for candles with:
a small body
a long upper wick
a small lower wick
One of the main strengths of this script is its flexibility. Users can adjust how strict the pin bar definition should be through the available inputs:
Max body % of candle range: sets the maximum body size allowed relative to the full candle range
Min long wick % of candle range: requires the main wick to represent at least a certain percentage of the full candle range
Max opposite wick % of candle range: limits the size of the opposite wick so the candle keeps a clean pin bar structure
In addition to wick and body structure, the indicator also includes an optional candle color filter for stricter confirmation:
Bullish Pin Bar must close bullish
Bearish Pin Bar must close bearish
This helps filter out candles that visually resemble pin bars but close with weaker confirmation.
For visualization, the indicator supports:
bullish markers below bullish pin bars
bearish markers above bearish pin bars
optional text labels
optional candle coloring for detected pin bars
built-in alert conditions for TradingView alerts
This indicator can be useful in many price action situations, such as:
spotting reversal candles at support and resistance
identifying rejection candles in trending markets
combining with market structure, supply and demand, trendlines, or moving averages
scanning for price action setups across multiple timeframes
Disclaimer: This indicator is for educational and research purposes only. It does not provide financial advice or guarantee trading performance.
Pine Script® indicator















