How it is calculated
Bullish when the third candle's low is above the first candle's high: the gap runs from that high to that low. Bearish when the third high is below the first low. It counts when at least min_size times the ATR (Wilder, atr_length) at the third candle high. From the next bar a bullish gap is filled when a low reaches its bottom, or its middle with Filled at 50 %; bearish gaps mirror this.
Reference: ICT market structure, from public descriptions (#546)
How to read it
The lines show the nearest open bullish gap (the highest) and the nearest bearish one (the lowest); None when there is none. The new and filled flags are 1 on the bar of the event. A gap shows on its third candle, never earlier, and at most max_zones per side are kept.
In a strategy
Buy the retest: with g = ctx.ind("fvg", atr_length=14, min_size=0.25, fill="half") a long limit at g.bull_top with the stop below g.bull_bottom, cancelled when g.bull_filled is 1.
Inputs
| Input | Type | Default | Range or choices |
|---|---|---|---|
ATR lengthatr_length | Whole number | 14 | min 1, max 500 |
Minimum size (ATR)min_size | Number | 0.25 | min 0, max 10 |
Filled atfill | Choice | "full" | Full pass, 50 % (consequent encroachment) |
Zones kept per sidemax_zones | Whole number | 20 | min 1, max 500 |
What it draws
| Line | Drawn as |
|---|---|
| Bullish top | Steps |
| Bullish bottom | Steps |
| Bearish top | Steps |
| Bearish bottom | Steps |
Used in
No strategy template reads it yet.