OPEN-SOURCE SCRIPT
FVG Imbalance Tracker TGFX

FVG Imbalance Tracker
OVERVIEW
FVG Imbalance Tracker automatically detects, draws and tracks Fair Value Gaps (FVG), also known as imbalances. It marks each gap as a zone, extends it until price returns, and tells you when the gap has been mitigated (filled). An optional 50% midline (Consequent Encroachment / CE) and a higher-timeframe table give you context at a glance.
WHAT IS A FAIR VALUE GAP
A Fair Value Gap is a three-candle pattern where the first and third candles do not overlap, leaving a price range that was crossed in a single, one-sided move:
- Bullish FVG: the low of candle 3 is above the high of candle 1.
- Bearish FVG: the high of candle 3 is below the low of candle 1.
That untraded range is an imbalance. Price frequently returns to it later to "rebalance" before continuing, which is why these zones are useful as potential reaction areas.
HOW IT WORKS
1. On the close of every third candle, the script checks for a gap between candle 1 and candle 3.
2. If a gap is found (and passes the optional ATR size filter), a zone is drawn from the pattern to the right.
3. Each zone keeps extending until it is mitigated. You choose what mitigation means:
- Full fill: price fully closes the gap.
- 50% (CE): price reaches the midpoint (Consequent Encroachment).
- Touch: price reaches the near edge of the gap.
4. Once mitigated, the zone is dimmed and stops extending (or is removed, if you prefer).
HOW TO READ IT
- Green zones = bullish Fair Value Gaps (potential demand / support areas).
- Red zones = bearish Fair Value Gaps (potential supply / resistance areas).
- Solid, extending zone = still unmitigated.
- Dimmed zone = already mitigated.
- Dotted midline = the 50% (CE) level of the gap.
- Multi-timeframe table: shows the latest imbalance direction on three higher timeframes (Bull / Bear / –) for higher-timeframe context.
SETTINGS
- Detection: optional ATR filter to ignore small gaps, ATR length, minimum gap size (× ATR), and maximum gaps kept per side.
- Mitigation: choose Full fill, 50% (CE) or Touch, and whether mitigated gaps stay dimmed or are removed.
- Visual: colors for bullish/bearish gaps, box transparency, optional border, optional 50% midline, optional labels, label size.
- Multi-timeframe table: enable/disable, the three timeframes, and table position.
REPAINTING
Gaps are confirmed on the close of the third candle, so a zone does not appear and then disappear intrabar.
ALERTS
Three alerts are available: "New bullish FVG", "New bearish FVG" and "FVG mitigated". Add them from the alert dialog and set them to trigger once per bar close.
NOTES
This script is an original implementation of standard, public price-action concepts (Fair Value Gaps and Consequent Encroachment). It is a visualization and context tool — it does not generate buy/sell signals and makes no claim about future performance. Fair Value Gaps work best combined with your own analysis (market structure, liquidity, higher-timeframe context, risk management) rather than used in isolation.
OVERVIEW
FVG Imbalance Tracker automatically detects, draws and tracks Fair Value Gaps (FVG), also known as imbalances. It marks each gap as a zone, extends it until price returns, and tells you when the gap has been mitigated (filled). An optional 50% midline (Consequent Encroachment / CE) and a higher-timeframe table give you context at a glance.
WHAT IS A FAIR VALUE GAP
A Fair Value Gap is a three-candle pattern where the first and third candles do not overlap, leaving a price range that was crossed in a single, one-sided move:
- Bullish FVG: the low of candle 3 is above the high of candle 1.
- Bearish FVG: the high of candle 3 is below the low of candle 1.
That untraded range is an imbalance. Price frequently returns to it later to "rebalance" before continuing, which is why these zones are useful as potential reaction areas.
HOW IT WORKS
1. On the close of every third candle, the script checks for a gap between candle 1 and candle 3.
2. If a gap is found (and passes the optional ATR size filter), a zone is drawn from the pattern to the right.
3. Each zone keeps extending until it is mitigated. You choose what mitigation means:
- Full fill: price fully closes the gap.
- 50% (CE): price reaches the midpoint (Consequent Encroachment).
- Touch: price reaches the near edge of the gap.
4. Once mitigated, the zone is dimmed and stops extending (or is removed, if you prefer).
HOW TO READ IT
- Green zones = bullish Fair Value Gaps (potential demand / support areas).
- Red zones = bearish Fair Value Gaps (potential supply / resistance areas).
- Solid, extending zone = still unmitigated.
- Dimmed zone = already mitigated.
- Dotted midline = the 50% (CE) level of the gap.
- Multi-timeframe table: shows the latest imbalance direction on three higher timeframes (Bull / Bear / –) for higher-timeframe context.
SETTINGS
- Detection: optional ATR filter to ignore small gaps, ATR length, minimum gap size (× ATR), and maximum gaps kept per side.
- Mitigation: choose Full fill, 50% (CE) or Touch, and whether mitigated gaps stay dimmed or are removed.
- Visual: colors for bullish/bearish gaps, box transparency, optional border, optional 50% midline, optional labels, label size.
- Multi-timeframe table: enable/disable, the three timeframes, and table position.
REPAINTING
Gaps are confirmed on the close of the third candle, so a zone does not appear and then disappear intrabar.
ALERTS
Three alerts are available: "New bullish FVG", "New bearish FVG" and "FVG mitigated". Add them from the alert dialog and set them to trigger once per bar close.
NOTES
This script is an original implementation of standard, public price-action concepts (Fair Value Gaps and Consequent Encroachment). It is a visualization and context tool — it does not generate buy/sell signals and makes no claim about future performance. Fair Value Gaps work best combined with your own analysis (market structure, liquidity, higher-timeframe context, risk management) rather than used in isolation.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.