How it is calculated
Gaps are found as in fvg (third candle against the first, at least min_size ATRs). A bullish gap is inverted on the first close below its bottom and becomes a bearish zone with the same top and bottom; a bearish gap on the first close above its top becomes a bullish zone. An inverted zone ends on a close back through its far side: a bullish one below its bottom, a bearish one above its top.
Reference: ICT market structure, from public descriptions (#546)
How to read it
The lines show the nearest bullish zone (the highest) and the nearest bearish one (the lowest). new is 1 on the bar that inverts a gap, broken on the bar that ends a zone. Gaps waiting to be inverted and inverted zones are each kept up to max_zones per side.
In a strategy
Sell the retest of a broken gap: when z = ctx.ind("ifvg", atr_length=14, min_size=0.25) has z.bear_new of 1, a short limit at z.bear_bottom with the stop above z.bear_top.
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 |
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.