OPEN-SOURCE SCRIPT
Auto Fair Value Gap (FVG) Pro [identityKa]

Overview
The Auto Fair Value Gap (FVG) Pro [identityKa] is an essential Smart Money Concepts (SMC) tool engineered to detect and highlight institutional price imbalances. An FVG occurs when strong momentum creates a gap in price delivery, leaving an inefficiency between buyers and sellers. This script mathematically identifies these 3-bar structures in real-time, plotting them as dynamic zones. It goes a step further by offering automated chart mitigation (cleaning) and plotting the highly sought-after 50% Consequent Encroachment (CE) level.
Core Detection & Mitigation Mechanics
The algorithm evaluates price action strictly based on a 3-candle sequence:
Bullish FVG (Demand Imbalance): Identified when the Low of the 3rd candle is strictly higher than the High of the 1st candle, and the 2nd candle is bullish. This creates an unmitigated gap of buy-side liquidity.
Bearish FVG (Supply Imbalance): Identified when the High of the 3rd candle is strictly lower than the Low of the 1st candle, and the 2nd candle is bearish. This creates a sell-side imbalance.
Smart Mitigation (Wick vs. Close): The script allows the user to define what constitutes a "filled" gap. In "Wick" mode, the gap is instantly deleted from the chart the moment a subsequent candle's wick sweeps through the zone. In "Close" mode, the gap remains active until a candle's body strictly closes inside or beyond the zone, ensuring the chart stays clean and only relevant institutional targets remain visible.
The Consequent Encroachment (50% CE)
Institutions frequently target the exact middle of an imbalance. By default, this script draws a dashed line at the exact 50% mathematical equilibrium of every active FVG box. This serves as a precise entry point or target for advanced SMC traders.
HUD Dashboard & AI Logic
The integrated panel provides an instant read on the imbalance bias and risk state:
Dangerous: Displayed whenever the current live price action enters an active FVG zone. This signifies that the gap is actively being filled and high volatility is expected as orders are absorbed.
LONG: Triggered when the last detected FVG was Bullish, indicating that recent institutional momentum was upward and unmitigated demand zones lie below as support.
SHORT: Triggered when the last detected FVG was Bearish, indicating a dominance in sell-side momentum.
How to Use It
This tool is exceptionally powerful for Price Action trading, particularly on 15-minute and 1-hour timeframes where intraday institutional gaps frequently occur and are reliably filled. Traders should not blindly buy or sell when an FVG forms. Instead, use the FVG boxes as high-probability reversal zones. When the AI Suggestion reads "Dangerous" (price is inside the gap), monitor the price action on a lower timeframe. Wait for a rejection from the box—specifically near the 50% CE dashed line—before executing a trade in the direction of the macro trend.
The Auto Fair Value Gap (FVG) Pro [identityKa] is an essential Smart Money Concepts (SMC) tool engineered to detect and highlight institutional price imbalances. An FVG occurs when strong momentum creates a gap in price delivery, leaving an inefficiency between buyers and sellers. This script mathematically identifies these 3-bar structures in real-time, plotting them as dynamic zones. It goes a step further by offering automated chart mitigation (cleaning) and plotting the highly sought-after 50% Consequent Encroachment (CE) level.
Core Detection & Mitigation Mechanics
The algorithm evaluates price action strictly based on a 3-candle sequence:
Bullish FVG (Demand Imbalance): Identified when the Low of the 3rd candle is strictly higher than the High of the 1st candle, and the 2nd candle is bullish. This creates an unmitigated gap of buy-side liquidity.
Bearish FVG (Supply Imbalance): Identified when the High of the 3rd candle is strictly lower than the Low of the 1st candle, and the 2nd candle is bearish. This creates a sell-side imbalance.
Smart Mitigation (Wick vs. Close): The script allows the user to define what constitutes a "filled" gap. In "Wick" mode, the gap is instantly deleted from the chart the moment a subsequent candle's wick sweeps through the zone. In "Close" mode, the gap remains active until a candle's body strictly closes inside or beyond the zone, ensuring the chart stays clean and only relevant institutional targets remain visible.
The Consequent Encroachment (50% CE)
Institutions frequently target the exact middle of an imbalance. By default, this script draws a dashed line at the exact 50% mathematical equilibrium of every active FVG box. This serves as a precise entry point or target for advanced SMC traders.
HUD Dashboard & AI Logic
The integrated panel provides an instant read on the imbalance bias and risk state:
Dangerous: Displayed whenever the current live price action enters an active FVG zone. This signifies that the gap is actively being filled and high volatility is expected as orders are absorbed.
LONG: Triggered when the last detected FVG was Bullish, indicating that recent institutional momentum was upward and unmitigated demand zones lie below as support.
SHORT: Triggered when the last detected FVG was Bearish, indicating a dominance in sell-side momentum.
How to Use It
This tool is exceptionally powerful for Price Action trading, particularly on 15-minute and 1-hour timeframes where intraday institutional gaps frequently occur and are reliably filled. Traders should not blindly buy or sell when an FVG forms. Instead, use the FVG boxes as high-probability reversal zones. When the AI Suggestion reads "Dangerous" (price is inside the gap), monitor the price action on a lower timeframe. Wait for a rejection from the box—specifically near the 50% CE dashed line—before executing a trade in the direction of the macro trend.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.