OPEN-SOURCE SCRIPT

Fake Pin Bar & Engulfing Pattern Detector

7 160
Fake Pin Bar & Engulfing Pattern Detector

This indicator is designed to detect Fake Pin Bar structures and standard Engulfing candle patterns directly on the chart.

A Fake Pin Bar is a price action pattern that appears after price forms a Mother Bar, then one or more Inside Bars, and finally produces a false breakout candle. The signal candle briefly breaks outside the Mother Bar range, but then returns back inside the structure. If that breakout candle also has a strong rejection wick and a relatively small body, the indicator marks it as a Fake Pin Bar.

The idea behind this pattern is simple: price attempts to break above or below a consolidation area, fails to continue, and closes back inside the previous range. This can show rejection, trapped breakout traders, or a possible reversal area.

How The Indicator Works

The script looks for three main components:

1. Mother Bar
A candle that defines the main high and low range.

2. Inside Bar Sequence
One or more candles after the Mother Bar that remain inside the Mother Bar range.

3. False Breakout Pin Bar
The signal candle must break only one side of the Mother Bar range and then return back inside it. For a bearish signal, price breaks above the Mother Bar high and rejects downward. For a bullish signal, price breaks below the Mother Bar low and rejects upward.

The indicator also detects standard bullish and bearish Engulfing patterns. An engulfing pattern is detected when the current candle body fully engulfs the previous candle body in the opposite direction.

Best Use Cases

This indicator is best used as a price action confirmation tool, not as a standalone trading system.

It can be useful around:

- Support and resistance areas
- Supply and demand zones
- Previous session highs and lows
- Liquidity sweep areas
- Consolidation breakouts
- Higher timeframe key levels
- Trend pullbacks
- Range boundaries

Fake Pin Bars are generally more meaningful when they appear at important market levels instead of random areas in the middle of a chart.

Settings

Minimum Wick Ratio
Controls how large the rejection wick must be compared to the full candle range. A higher value requires a stronger wick and produces fewer signals.

Maximum Body Ratio
Controls the maximum allowed candle body size compared to the full candle range. A lower value requires a smaller body and makes the pin bar condition stricter.

Maximum Inside Bar Count
Defines how many Inside Bars the script can look for after the Mother Bar. A higher value allows the indicator to detect longer consolidation structures.

Confirm Signals After Bar Close
When enabled, signals are confirmed only after the candle closes. This helps avoid signals changing during the live candle.

Require Body Inside Mother Bar
When enabled, the signal candle body must return fully inside the Mother Bar range. This makes Fake Pin Bar detection stricter.

Show Engulfing Candles
Turns standard bullish and bearish Engulfing candle detection on or off.

Show Pattern Details
Shows or hides the Mother Bar pattern box and high/low guide lines.

Label Text Size
Changes the size of the Fake Pin Bar signal labels.

Inside Bar Area Opacity
Controls the opacity of the pattern area shown on the chart.

Bullish Candle Color
Sets the color used for bullish Engulfing candles.

Bearish Candle Color
Sets the color used for bearish Engulfing candles.

Important Notes

This indicator does not place trades, does not calculate stop loss or take profit levels, and does not provide financial advice.

Signals should be combined with market structure, trend direction, volume, support/resistance, and proper risk management.

No price action pattern is perfect. Fake breakouts and engulfing candles can fail, especially in low-volume or choppy market conditions.

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.