A liquidity sweep is a price-action concept in which price briefly pushes beyond an obvious high or low — where stop orders and breakout orders tend to cluster — and then reverses back inside the prior range. Traders in the smart-money / price-action community use it as a context cue, not a guarantee: the idea is that the move "swept" resting liquidity before continuing in another direction. This page explains how the concept is defined and used, with a valid Pine v6 detection/marker script. It is educational only; nothing here is predictive, and trading carries the risk of loss.
A liquidity sweep (also called a "stop hunt," "liquidity grab," or "sweep of liquidity") is built on a simple observation about where orders accumulate. Obvious swing highs and lows, round numbers, prior-day/session highs and lows, and equal highs/lows ("double tops/bottoms" that look like a clean ceiling or floor) are places where many traders place protective stop-loss orders and pending breakout orders. A short position's protective stop above a high is a buy order; a long position's protective stop below a low is a sell order. A cluster of such resting orders is what the trading community loosely calls "liquidity."
The concept, as popularised in the smart-money / ICT (Inner Circle Trader) community and broader price-action education, describes a sequence: (1) price approaches a well-known level where liquidity is presumed to rest; (2) it spikes just beyond that level, often on a single bar or a short burst, triggering those resting stops and breakout entries; and (3) it fails to hold beyond the level and trades back inside the prior range. The narrative is that the brief excursion "collected" the liquidity needed to fill larger orders, and that a move then unfolds in the opposite direction to the sweep. A bullish-context sweep dips below a prior low and reverses up; a bearish-context sweep pokes above a prior high and reverses down. This is a narrative traders use to organise what they see — it is not a verified description of order flow, and nothing about it is predictive.
Mechanically, a sweep is usually identified after the fact by two features on the chart: a wick or close that exceeds a reference high/low, followed by a return back across that level (a "failure to follow through"). Many traders combine the sweep with a market-structure shift — for example, a sweep of a low followed by price breaking a recent minor high (a "break of structure" / "change of character") — before they treat it as actionable context. The sweep alone is descriptive; the structure shift is what some traders use to define a trigger.
Importantly, this is a discretionary, context-dependent idea, not a self-contained mechanical edge. The same wick beyond a level can be the start of a genuine breakout rather than a sweep — you only know it was a "sweep" once price has reversed. Because of that ambiguity, the concept does not cleanly reduce to a fully mechanical strategy. The Pine script below is therefore an illustrative detection/marker tool that flags candidates (a wick beyond a recent swing level that closes back inside, evaluated only on confirmed/closed bars), so you can study how often the pattern appears and how price behaves afterward on your own instrument and timeframe. It plots markers only and does not generate orders, targets, or any claim about outcomes.
//@version=6
// Liquidity Sweep — ILLUSTRATIVE DETECTION/MARKER ONLY.
// The "liquidity sweep" concept is discretionary and context-dependent: a wick
// beyond a level is only a "sweep" once price reverses, so it does NOT reduce to
// a clean mechanical strategy. This indicator merely MARKS candidate sweeps
// (a wick beyond a recent pivot that closes back inside the range), evaluated
// ONLY on confirmed/closed bars so the markers do not repaint intrabar, so you
// can study them. It places no orders and makes no claim about outcomes.
// Educational only. Nothing here is predictive. Trading involves risk of loss.
indicator("Liquidity Sweep — Illustrative Detector", overlay = true)
// --- Inputs ---
leftLen = input.int(10, "Pivot lookback (left)", minval = 1)
rightLen = input.int(10, "Pivot lookback (right)", minval = 1)
// --- Reference liquidity levels: confirmed swing highs/lows ---
// ta.pivothigh/low confirm 'rightLen' bars after the pivot, so the level is not
// repainting once printed; we hold the most recent confirmed level.
ph = ta.pivothigh(high, leftLen, rightLen)
pl = ta.pivotlow(low, leftLen, rightLen)
var float lastSwingHigh = na
var float lastSwingLow = na
if not na(ph)
lastSwingHigh := ph
if not na(pl)
lastSwingLow := pl
// --- Candidate sweep detection on the just-closed bar ---
// barstate.isconfirmed gates detection to bars whose OHLC is final, so a
// candidate cannot appear then vanish while the live bar is still forming.
// Bearish-context sweep: this bar's high pierced the prior swing high
// but the bar CLOSED back below it (failed breakout above liquidity).
sweptHigh = barstate.isconfirmed and not na(lastSwingHigh) and high > lastSwingHigh and close < lastSwingHigh
// Bullish-context sweep: this bar's low pierced the prior swing low
// but the bar CLOSED back above it (failed breakdown below liquidity).
sweptLow = barstate.isconfirmed and not na(lastSwingLow) and low < lastSwingLow and close > lastSwingLow
// --- Markers (visual study aids only) ---
plotshape(sweptHigh, title = "Swept high", style = shape.triangledown,
location = location.abovebar, color = color.red, size = size.tiny,
text = "sweep")
plotshape(sweptLow, title = "Swept low", style = shape.triangleup,
location = location.belowbar, color = color.green, size = size.tiny,
text = "sweep")
// Plot the tracked reference levels for context.
plot(lastSwingHigh, "Last swing high", color = color.new(color.red, 60))
plot(lastSwingLow, "Last swing low", color = color.new(color.green, 60))
alertcondition(sweptHigh, "Candidate swept high", "Wick above prior swing high, closed back inside")
alertcondition(sweptLow, "Candidate swept low", "Wick below prior swing low, closed back inside")They describe the same observable event from different angles. 'Stop hunt' emphasises the triggering of clustered stop-loss orders just beyond an obvious level; 'liquidity sweep' (or 'liquidity grab') is the smart-money / price-action framing for price reaching beyond that level to interact with resting orders before reversing. Both are descriptive narratives about a wick beyond a level that fails to hold — neither implies any particular outcome.
Not cleanly. Whether a wick beyond a level is a 'sweep' or a real breakout is only known after price reverses, and which level counts as 'liquidity' is a discretionary choice. You can automate detection of candidates — a wick that pierces a recent swing high/low and closes back inside, as in the illustrative script above — but turning that into a mechanical strategy with entries, stops and targets requires assumptions (confirmation rules, invalidation, targets) that vary by trader. Treat any such script as a study/marker tool, evaluate it on confirmed (closed) bars to avoid intrabar repainting, and never assume the markers imply profitability.
Most add a second condition rather than trading the sweep alone. Common filters include requiring the candle to close back inside the prior range (a failed breakout), waiting for a subsequent market-structure shift such as a break of a recent minor swing in the reversal direction, aligning the sweep with a higher-timeframe bias or a level of interest, and defining a hard invalidation just beyond the sweep wick. These are study criteria, not guarantees — sweeps are confirmed only in hindsight and trading always carries the risk of loss.
Educational & software only — not financial advice, not a recommendation to trade. Backtests are illustrative; past performance does not predict future results. Trading involves substantial risk of loss.