Liquidity sweeps

Equal highs and lows, and wicks that run past them or past a swing point and close back.

Liquidity from confirmed swing pivots (swing params as swing). Equal highs: a new swing high within max(floor_pct % × close, eq_k × ATR) of one of the last eq_pivots highs, at least min_sep candles apart, with no higher swing high between them; the level is the higher of the two (equal lows mirror it). sweep_high = a wick above an equal-highs level or the last swing high by more than sweep_k ATRs, closing back below it; any wick past a level by that much takes the level. Levels expire max_age_bars after they are made. last_sweep_high_level / last_sweep_low_level = the high / low of the last candle that made sweep_high / sweep_low, from that candle until the next sweep of the same side, at most max_age_bars candles.

Liquidity sweeps is a structure detector: it marks price structure on the chart and counts against the plan's detector limit.

Settings

SettingDefaultRangeWhat it does
atr_period141 to 500ATR length (Wilder) for every buffer.
swing_k20.1 to 20Swing reversal in ATRs: a pivot is confirmed when a close moves this far back.
swing_min_pct0.10 to 10Smallest swing reversal, % of the close.
eq_k0.10 to 5Equal highs/lows: largest difference in ATRs.
eq_pivots51 to 20Earlier swing points compared with a new one.
min_sep51 to 500Equal highs/lows: fewest candles between the two points.
sweep_k0.050 to 5A sweep's wick must pass the level by this many ATRs.
floor_pct0.020 to 10Smallest buffer of this detector, % of the close (each buffer is the larger of this and its ATR multiple).
max_age_bars20010 to 2000Candles after its birth until a zone or level expires.

What it gives

OutputWhat it is
High sweepTrue when a wick runs above a high level and the close falls back below it.
Low sweepTrue when a wick runs below a low level and the close comes back above it.
Equal highs levelThe active equal-highs level.
Equal lows levelThe active equal-lows level.
Last high sweep levelHigh of the last candle that swept a high level (its wick); a short's stop above the sweep.
Last low sweep levelLow of the last candle that swept a low level (its wick); a long's stop below the sweep.

What it reads

It reads the whole candle (open, high, low, close and volume).

Warm-up

With its default settings, Liquidity sweeps needs 441 closed candles before its first value. A backtest loads them before its start date, so the first trade can already use it.

Test it

Copy this sentence into the Algonney chat to backtest it:

Backtest a strategy on BTC that uses Liquidity sweeps with its default settings