stratester.com

Patterns · condition block

Liquidity sweep

A liquidity sweep is a candle that pokes beyond a recent high or low, often triggering stop orders, and then closes back inside the range. The block fires on that candle.

How the engine evaluates it

For low, the engine finds the lowest low of the previous N candles. The block fires when the current candle's low goes below it but the close is back above it.

For high, the current high must exceed the highest high of the previous N candles while the close ends below that high.

Formula
low:  low[t] < min(low of previous N)  and  close[t] > that low
high: high[t] > max(high of previous N)  and  close[t] < that high

Botscript syntax

In the Lab you pick this block from the Patterns group and fill in its fields. In the code view the same condition is written like this:

sweep low 48
sweep high 24

Settings

SettingValuesDefaultNotes
Sidelow, highlowSweep of the range low or high.
Lookback2 – 1,000 candles48Size of the range being swept.
Timeframethe run's candles, or 15m, 30m, 1h, 2h, 4h, 6h, 12h, 1d, 1wthe run's candlesOptional. At least the run's candle size and a whole multiple of it.

On a higher timeframe

Add a timeframe at the end to read Liquidity sweep from bigger candles than the run uses, for example sweep low 20 on 1d. The engine builds those candles from the run's own candles (UTC, weeks start on Monday) and evaluates the block only on candles that have closed, so there is no look-ahead. Lengths and lookbacks count the bigger candles.

Liquidity sweep is an event on a higher timeframe: it fires once, on the run candle that closes the bigger candle where it happened, and is false on the other run candles.

The timeframe must be at least the run's candle size and a whole multiple of it; otherwise the run stops with an error and is not charged. Multi-timeframe conditions covers the details, including warm-up.

How traders use it

  • Reversal entries: sweep low 48 as a failed breakdown.
  • Exits: sweep high 48 with holding as a failed breakout.

Example bot

botscript
bot "Stop Hunt Reversal"

when sweep low 48
then buy 50%

when pnl up 4% or pnl down 2%
then sell 100%
  • Buys when a candle wicks below the 48-candle low but closes back above it.
  • Takes profit at +4% or cuts the trade at −2% from the average entry.

Pitfalls

  • A sweep can be followed by a real breakdown a few candles later. Keep a stop.
  • Results are sensitive to the lookback; test a few values.

Liquidity sweep: frequently asked questions

What is the difference from a breakout?

A breakout closes beyond the range. A sweep only wicks beyond it and closes back inside.

Is the current candle part of the range?

No, the range is the N candles before it.

Why is it called a liquidity sweep?

Stop orders cluster just beyond obvious highs and lows. A quick move through them and back is read as someone taking that liquidity.

What lookback should I start with?

24 to 48 candles is common on 1-hour charts; larger values look at more significant levels.

Simulated results are hypothetical. They include only the fee and slippage you set on the bot, not every real-world cost or market condition, and past performance does not guarantee future results. Nothing here is financial advice.