Buy and sell side liquidity
All indicators

LibraryMarket structure

Indicator

Buy and sell side liquidity

Where the resting stops are: the nearest swing high no later price has traded above (buy side) and the nearest swing low none has traded below (sell side).

Market structureOn the price2 inputsLiquidity

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

InputTypeDefaultRange or choices
Swing bars each sidelengthWhole number3min 1, max 50
Zones kept per sidemax_zonesWhole number20min 1, max 500

What it draws

LineDrawn as
Buy sideSteps
Sell sideSteps

Used in

No strategy template reads it yet.

OrionQuant