OPEN-SOURCE SCRIPT
Candle PA Scanner (Engulfing / Inside / Pin) by BK Sahni

Here’s how to read the “Candle PA Scanner (Engulfing / Inside / Pin)” and what each input means.
What the signals look like on your chart
B-ENG (label above/below bar)
Bullish Engulfing → “B-ENG” below the bar (green/teal).
Bearish Engulfing → “B-ENG” above the bar (red).
IB (small orange dot at the top)
Inside Bar (compression). Use the mother bar’s high/low for the break.
PIN (triangle)
Bullish Pin → triangle below the bar (long lower wick; rejection of support).
Bearish Pin → triangle above the bar (long upper wick; rejection of resistance).
Treat these as price-action alerts, not automatic buy/sell signals. Act only when they occur at your levels (VWAP band, Fib 38.2–61.8, PDH/PDL, OB/FVG, etc.).
How to trade the prints (quick rules)
A) Bullish Engulfing at support
Context: at VWAP/VAL/0.5–0.618 Fib.
Entry: next candle above the engulfing high (or market order on close if volume/momentum confirm).
Stop: a tick below the engulfing low (or below the level).
Targets: mid/range, VWAP, prior swing; trail with Chandelier/ATR if trend extends.
B) Bearish Engulfing at resistance
Mirror the above: trigger below the engulfing low; stop above its high.
C) Inside Bar
It’s compression. Mark the mother bar’s high/low.
Trade the breakout in the direction of bias (above VWAP for longs, below for shorts).
If the break fails (closes back inside), often sets up a reversal—manage fast.
D) Pin Bar (rejection)
Enter on break of the pin’s body in the direction away from the wick.
Stop beyond the wick tip (invalidated if wick gets closed through).
Scale at VWAP/mid or the opposite range edge.
What the Inputs do (the panel you showed)
Inside Bar lookback (default 1)
How many bars back can be the mother bar.
Keep 1 for strict IB; raise to 2–3 to catch nested/compression patterns (more signals, a bit noisier).
Pin wick:body min ratio (default 2)
How long the rejection wick must be compared to the body.
Higher (2.5–3.0) = pickier, great in chop.
Lower (1.5–1.8) = more pins, useful in strong trends where wicks are shorter.
Min body % of range (0–1) (default 0.25)
Filters out dojis. The body must be at least 25% of the bar’s high-low range.
If you want to allow slimmer bodies (more pins/dojis), drop to 0.15–0.20.
If you want only decisive bodies, raise to 0.30–0.35.
Suggested tuning by market state
Trending / high momentum:
IB lookback 1, Pin ratio 1.8–2.2, Min body 0.20–0.25 (to catch more continuation entries).
Ranging / choppy:
IB lookback 2, Pin ratio 2.5–3.0, Min body 0.30 (fewer, higher-quality reversals).
A simple confluence checklist (use before clicking)
Signal printed at a level (VWAP band, Fib, PDH/PDL, OB/FVG)?
Bias aligned (above VWAP for longs, below for shorts) or you’re intentionally fading a range edge?
For engulfing: did it close through nearby minor structure?
For IB: are you trading the mother bar break, not just the small inside candle?
Risk defined: stop beyond wick/zone, target mapped (mid/VWAP/swing/extension).
Common pitfalls
Taking signals mid-range (low R:R).
Treating an IB as a reversal without a break/shift.
Buying a bullish pin that closed below your level (no acceptance).
Ignoring volatility—during news spikes, patterns fail more often.
What the signals look like on your chart
B-ENG (label above/below bar)
Bullish Engulfing → “B-ENG” below the bar (green/teal).
Bearish Engulfing → “B-ENG” above the bar (red).
IB (small orange dot at the top)
Inside Bar (compression). Use the mother bar’s high/low for the break.
PIN (triangle)
Bullish Pin → triangle below the bar (long lower wick; rejection of support).
Bearish Pin → triangle above the bar (long upper wick; rejection of resistance).
Treat these as price-action alerts, not automatic buy/sell signals. Act only when they occur at your levels (VWAP band, Fib 38.2–61.8, PDH/PDL, OB/FVG, etc.).
How to trade the prints (quick rules)
A) Bullish Engulfing at support
Context: at VWAP/VAL/0.5–0.618 Fib.
Entry: next candle above the engulfing high (or market order on close if volume/momentum confirm).
Stop: a tick below the engulfing low (or below the level).
Targets: mid/range, VWAP, prior swing; trail with Chandelier/ATR if trend extends.
B) Bearish Engulfing at resistance
Mirror the above: trigger below the engulfing low; stop above its high.
C) Inside Bar
It’s compression. Mark the mother bar’s high/low.
Trade the breakout in the direction of bias (above VWAP for longs, below for shorts).
If the break fails (closes back inside), often sets up a reversal—manage fast.
D) Pin Bar (rejection)
Enter on break of the pin’s body in the direction away from the wick.
Stop beyond the wick tip (invalidated if wick gets closed through).
Scale at VWAP/mid or the opposite range edge.
What the Inputs do (the panel you showed)
Inside Bar lookback (default 1)
How many bars back can be the mother bar.
Keep 1 for strict IB; raise to 2–3 to catch nested/compression patterns (more signals, a bit noisier).
Pin wick:body min ratio (default 2)
How long the rejection wick must be compared to the body.
Higher (2.5–3.0) = pickier, great in chop.
Lower (1.5–1.8) = more pins, useful in strong trends where wicks are shorter.
Min body % of range (0–1) (default 0.25)
Filters out dojis. The body must be at least 25% of the bar’s high-low range.
If you want to allow slimmer bodies (more pins/dojis), drop to 0.15–0.20.
If you want only decisive bodies, raise to 0.30–0.35.
Suggested tuning by market state
Trending / high momentum:
IB lookback 1, Pin ratio 1.8–2.2, Min body 0.20–0.25 (to catch more continuation entries).
Ranging / choppy:
IB lookback 2, Pin ratio 2.5–3.0, Min body 0.30 (fewer, higher-quality reversals).
A simple confluence checklist (use before clicking)
Signal printed at a level (VWAP band, Fib, PDH/PDL, OB/FVG)?
Bias aligned (above VWAP for longs, below for shorts) or you’re intentionally fading a range edge?
For engulfing: did it close through nearby minor structure?
For IB: are you trading the mother bar break, not just the small inside candle?
Risk defined: stop beyond wick/zone, target mapped (mid/VWAP/swing/extension).
Common pitfalls
Taking signals mid-range (low R:R).
Treating an IB as a reversal without a break/shift.
Buying a bullish pin that closed below your level (no acceptance).
Ignoring volatility—during news spikes, patterns fail more often.
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。