How it is calculated
A bullish candle whose body (close minus open) is more than min_body times the ATR (Wilder, atr_length) at that candle, and which is the middle candle of a bullish gap as in fvg (the next candle's low above the high before it, at least min_size ATRs). Bearish mirrors this. up and down are 1 on the bar after the candle, which completes the gap; high, low and body_atr hold the last one's.
Reference: ICT liquidity concepts, from public descriptions (#546)
How to read it
The flag comes one bar after the large candle, because only the next candle shows whether it left a gap; it is never set earlier. high and low frame the candle that displaced price, a reference for entries on the retrace.
In a strategy
Trade with the displacement: when d = ctx.ind("displacement", min_body=1.5) has d.up of 1, look for longs on a pullback toward d.low.
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 |
Minimum body (ATR)min_body | Number | 1 | min 0, max 10 |
What it draws
| Line | Drawn as |
|---|---|
| Candle high | Steps |
| Candle low | Steps |
Used in
No strategy template reads it yet.