Tool
Fair Value Gap (SMC)
market.fair_value_gap
Inputs
No typed inputs.
Outputs
A bundle of fair-value-gap zones, each with its top price, bottom price, direction, and whether it has been mitigated yet. Feed it into interpretor.smc_zone to react when price enters or fills a gap.
A fair-value gap is a price imbalance left behind when the market moves so fast that three candles fail to overlap, leaving a window with no trading. Price tends to come back and 'fill' that gap, so this tool finds those windows and tells you when price returns to mitigate them.
How it works
It scans every run of three consecutive bars and measures the gap between the first bar's extreme and the third bar's opposite extreme (for a bullish gap, candle 1's high vs candle 3's low). When that gap is at least min_gap wide it records an imbalance zone; the mitigation_method then decides how far price must re-enter the zone before the gap counts as filled. Each kept zone is emitted with its top and bottom price.
Modes
Direction options
Keeps only up-side imbalances, where price jumped up and left an unfilled gap below it (a demand pocket price may dip back into).
When to use: Long-only setups that want to buy a pullback into bullish inefficiency.
Keeps only down-side imbalances, where price dropped fast and left an unfilled gap above it (a supply pocket price may rally back into).
When to use: Short-only setups that want to sell a rally into bearish inefficiency.
Reports bullish and bearish gaps together, so you see every imbalance regardless of which way price displaced.
When to use: Two-sided strategies, or when you map all open inefficiencies before deciding bias.
Mitigation method options
Marks the gap as filled as soon as any wick pokes into the zone, the most sensitive rule.
When to use: When the lightest test of the imbalance should already count as mitigated.
Requires a bar to close inside the zone before it counts as filled, ignoring wicks that pierce and pull back.
When to use: When you want a committed re-entry, not a fleeting spike, to retire the gap.
Treats the gap as filled once price reaches the halfway line of the zone, the classic 'consequent encroachment' level.
When to use: A balanced rule between a wick touch and a full close, popular for partial fills.
Configuration
Which side of imbalance to keep: bullish (gap below a fast up-move), bearish (gap above a fast down-move), or both.
The smallest gap size, in price, that still counts as a fair-value gap. Larger values keep only wide, significant imbalances and discard hairline ones.
When on, the middle candle must close strongly in the gap's direction (a real displacement bar), filtering out lazy three-bar windows that merely failed to overlap.
How price must re-enter a gap before it is considered filled: wick (any touch), close (a bar closes inside), or average (price reaches the 50% midpoint).
Caps how many of the most recent unfilled gaps are kept and emitted. Smaller keeps only the freshest imbalances; larger retains a deeper history of open gaps.
Connects to
Examples
- In bullish direction with mitigation_method 'average', mark a long zone and wait for price to tag the 50% of an up-side gap before entering.
- Feed the emitted zones into interpretor.smc_zone to fire a signal the first time price re-enters an unfilled bearish gap.
Common mistakes
- Setting min_gap to 0 on a noisy symbol, which floods you with tiny, meaningless three-bar gaps.
- Forgetting that a 'filled' gap is no longer tradable as an imbalance — once mitigated, it has done its job and price often continues.