OPEN-SOURCE SCRIPT
Smart-FVG

Smart-FVG — Fair Value Gaps with Wick-Touch Tracking & Inverse FVG
Smart-FVG detects three-candle Fair Value Gaps and then tracks what price *does* with them. Instead of just drawing boxes, it distinguishes between untouched gaps, gaps that have been wick-tested, and gaps that have been fully mitigated — and it highlights the single most recently mitigated gap as a potential Inverse FVG (a gap that may now act as the opposite side's support/resistance).
How it works
Detection. A bullish FVG forms when the current candle's low gaps above the high from two candles back; a bearish FVG forms when the current candle's high gaps below the low from two candles back. Two quality filters keep the chart clean:
Both sizes can be entered in ticks (automatically scaled to the symbol's tick size — 0.25 on NQ/ES, 0.10 on GC, etc.) or in raw price points.
Wick-touch tracking. If a wick pierces into the gap but the candle closes back outside it, the FVG is recolored (gray by default). The level was tested and respected — often a sign of a partially filled gap that may still hold, but with less "fresh" liquidity than an untouched one.
Mitigation. When a candle *closes* through the far side of the gap, the FVG is considered fully mitigated and is removed from the chart. Wicks alone never mitigate — only closes.
Inverse FVG. The most recently mitigated gap is redrawn in a distinct color (purple by default) from its original starting point. A bullish FVG that price closed through often flips into resistance, and vice versa — this is the inversion (iFVG) concept. Only the single latest mitigation is shown to avoid clutter, and the highlight extends for a configurable number of bars after mitigation before freezing in place. Each new mitigation replaces the previous inverse.
Every gap also displays a dashed equilibrium line at its 50% level — a common target for partial fills and a refined entry point inside the gap.
Settings
Notes
This indicator is a charting tool, not a trading system. FVGs and inversions describe how price has interacted with prior inefficiencies — always combine with your own analysis and risk management.
Smart-FVG detects three-candle Fair Value Gaps and then tracks what price *does* with them. Instead of just drawing boxes, it distinguishes between untouched gaps, gaps that have been wick-tested, and gaps that have been fully mitigated — and it highlights the single most recently mitigated gap as a potential Inverse FVG (a gap that may now act as the opposite side's support/resistance).
How it works
Detection. A bullish FVG forms when the current candle's low gaps above the high from two candles back; a bearish FVG forms when the current candle's high gaps below the low from two candles back. Two quality filters keep the chart clean:
- Min FVG Gap — the gap must be at least this size to be drawn.
- Min Middle-Candle Body — the displacement candle in the middle of the pattern must have a real body of at least this size, filtering out weak, low-conviction gaps.
Both sizes can be entered in ticks (automatically scaled to the symbol's tick size — 0.25 on NQ/ES, 0.10 on GC, etc.) or in raw price points.
Wick-touch tracking. If a wick pierces into the gap but the candle closes back outside it, the FVG is recolored (gray by default). The level was tested and respected — often a sign of a partially filled gap that may still hold, but with less "fresh" liquidity than an untouched one.
Mitigation. When a candle *closes* through the far side of the gap, the FVG is considered fully mitigated and is removed from the chart. Wicks alone never mitigate — only closes.
Inverse FVG. The most recently mitigated gap is redrawn in a distinct color (purple by default) from its original starting point. A bullish FVG that price closed through often flips into resistance, and vice versa — this is the inversion (iFVG) concept. Only the single latest mitigation is shown to avoid clutter, and the highlight extends for a configurable number of bars after mitigation before freezing in place. Each new mitigation replaces the previous inverse.
Every gap also displays a dashed equilibrium line at its 50% level — a common target for partial fills and a refined entry point inside the gap.
Settings
- Size Inputs In Ticks — toggle between tick-based and point-based gap/body sizing
- Min FVG Gap / Min Middle-Candle Body — quality filters described above
- Max Active FVGs Per Side — caps how many bullish and bearish gaps are kept on the chart (oldest are dropped first)
- Colors & Line Width — bullish, bearish, wick-touched, and inverse colors are all configurable
- Show Inverse FVG / Inverse Display Bars — toggle the iFVG highlight and control how long it extends after mitigation
Notes
- Boxes are drawn as outlines with a dashed midline, keeping candles fully visible.
- Works on any symbol and time frame; tick-based sizing makes settings portable across futures contracts.
- The gap-completion candle itself can mitigate or wick-test the gap it just created, keeping behavior consistent with strict close-based rules.
This indicator is a charting tool, not a trading system. FVGs and inversions describe how price has interacted with prior inefficiencies — always combine with your own analysis and risk management.
Open-source script
In true PulseWire spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by PulseWire. Read more in the Terms of Use.
Open-source script
In true PulseWire spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by PulseWire. Read more in the Terms of Use.
