How it is calculated
Swings as in structure. A confirmed swing high stays buy side liquidity until a later high trades above it, a swing low sell side liquidity until a later low trades below it; at most max_zones per side, the oldest dropped first. buy_side is the lowest untaken high, sell_side the highest untaken low. A bar first takes the levels known before it, then adds the swings it confirms.
Reference: ICT liquidity concepts, from public descriptions (#546)
How to read it
Untaken highs always lie at or above the latest high and untaken lows at or below the latest low, so the lines frame price. taken is 1 on the bar that trades through at least one level of that side; the line then moves on to the next level, or None when none is left.
In a strategy
Aim at the draw on liquidity: with q = ctx.ind("liquidity", length=5) a long targets q.buy_side and keeps its stop below q.sell_side.
Inputs
| Input | Type | Default | Range or choices |
|---|---|---|---|
Swing bars each sidelength | Whole number | 3 | min 1, max 50 |
Zones kept per sidemax_zones | Whole number | 20 | min 1, max 500 |
What it draws
| Line | Drawn as |
|---|---|
| Buy side | Steps |
| Sell side | Steps |
Used in
No strategy template reads it yet.