OPEN-SOURCE SCRIPT
Liquidity Sweep Indicator [Income Statement]

Liquidity Sweep & Reversal Detector
This indicator is built around a specific market structure concept: liquidity sweeps (also called stop-hunts), where price temporarily violates a known swing level to trigger resting orders, then immediately reverses back inside range. That failed breakout is the signal, not the breakout itself.
The three filters are not independent features — they are a deliberate confirmation stack designed to answer one question: is this reversal likely to be institutional, or is it retail noise?
HOW THE LOGIC WORKS
1. Swing Structure (Pivot Detection)
The script continuously tracks the most recent confirmed pivot highs and lows using a user-defined lookback period. These pivots represent visible liquidity pools — price levels where stop-loss orders from trapped traders are clustered.
2. The Sweep Condition
A bullish sweep is confirmed when: (a) the current bar's low dips below the most recent pivot low, and (b) the bar closes back above that level. This closing behaviour is critical — it distinguishes a genuine stop-hunt from a continuation breakdown. The reverse applies for bearish sweeps. A minimum sweep depth (%) filter prevents the script from triggering on negligible edge-grazes.
3. Volume Confirmation (Smart Money Filter)
Institutional absorption of liquidity typically produces above-average volume. The script compares the sweep bar's volume against a 20-bar simple moving average and requires it to exceed a configurable multiplier (default 1.7×). This single filter eliminates the majority of false positives generated by low-liquidity sweeps in off-hours or thin markets.
4. EMA Trend Alignment
To avoid taking counter-trend reversals in strong momentum environments, an optional EMA filter restricts bullish sweep signals to bars closing above the EMA, and bearish sweep signals to bars closing below it. This transforms the detector from a range-bound tool into one that works across trending and ranging conditions.
5. ATR-Based Targets
Take Profit levels are calculated as a multiple of the 14-period ATR from the close of the sweep bar. Because ATR is normalised to the instrument's volatility, the same multiplier setting produces sensible targets across assets with very different price scales — stocks, crypto, forex, and commodities. Targets are displayed in the asset's native tick precision using syminfo.mintick.
SETTINGS GUIDE
Swing Length (2–20): Controls the pivot lookback. Lower values (2–5) detect intraday liquidity pools; higher values (10–20) track significant swing highs/lows on higher timeframes.
Minimum Sweep % : Sets the minimum wick penetration beyond the pivot before a sweep is considered valid. Prevents false signals from minor wicks that barely exceed the level.
Volume Multiplier: Sweep bar volume must exceed this multiple of the 20-bar average. Increase for stricter institutional confirmation; decrease in lower-volume instruments.
EMA Length & Trend Filter Toggle: The EMA acts as a macro regime filter. When enabled, it restricts signals to the trend direction. Disable it in ranging/mean-reverting markets.
ATR Target Multiplier: Scales the Take Profit distance relative to recent volatility. 1.5 is a balanced default; tighten for scalping, widen for swing trades.
USAGE NOTES
This indicator works best when sweep signals align with additional confluence — for example, a bullish sweep occurring at a higher-timeframe support zone, a Fair Value Gap, or a daily demand area. The script does not predict reversals; it identifies the structural conditions under which reversals statistically have higher probability.
Always use proper risk management and do not rely on any single indicator in isolation.
This indicator is built around a specific market structure concept: liquidity sweeps (also called stop-hunts), where price temporarily violates a known swing level to trigger resting orders, then immediately reverses back inside range. That failed breakout is the signal, not the breakout itself.
The three filters are not independent features — they are a deliberate confirmation stack designed to answer one question: is this reversal likely to be institutional, or is it retail noise?
HOW THE LOGIC WORKS
1. Swing Structure (Pivot Detection)
The script continuously tracks the most recent confirmed pivot highs and lows using a user-defined lookback period. These pivots represent visible liquidity pools — price levels where stop-loss orders from trapped traders are clustered.
2. The Sweep Condition
A bullish sweep is confirmed when: (a) the current bar's low dips below the most recent pivot low, and (b) the bar closes back above that level. This closing behaviour is critical — it distinguishes a genuine stop-hunt from a continuation breakdown. The reverse applies for bearish sweeps. A minimum sweep depth (%) filter prevents the script from triggering on negligible edge-grazes.
3. Volume Confirmation (Smart Money Filter)
Institutional absorption of liquidity typically produces above-average volume. The script compares the sweep bar's volume against a 20-bar simple moving average and requires it to exceed a configurable multiplier (default 1.7×). This single filter eliminates the majority of false positives generated by low-liquidity sweeps in off-hours or thin markets.
4. EMA Trend Alignment
To avoid taking counter-trend reversals in strong momentum environments, an optional EMA filter restricts bullish sweep signals to bars closing above the EMA, and bearish sweep signals to bars closing below it. This transforms the detector from a range-bound tool into one that works across trending and ranging conditions.
5. ATR-Based Targets
Take Profit levels are calculated as a multiple of the 14-period ATR from the close of the sweep bar. Because ATR is normalised to the instrument's volatility, the same multiplier setting produces sensible targets across assets with very different price scales — stocks, crypto, forex, and commodities. Targets are displayed in the asset's native tick precision using syminfo.mintick.
SETTINGS GUIDE
Swing Length (2–20): Controls the pivot lookback. Lower values (2–5) detect intraday liquidity pools; higher values (10–20) track significant swing highs/lows on higher timeframes.
Minimum Sweep % : Sets the minimum wick penetration beyond the pivot before a sweep is considered valid. Prevents false signals from minor wicks that barely exceed the level.
Volume Multiplier: Sweep bar volume must exceed this multiple of the 20-bar average. Increase for stricter institutional confirmation; decrease in lower-volume instruments.
EMA Length & Trend Filter Toggle: The EMA acts as a macro regime filter. When enabled, it restricts signals to the trend direction. Disable it in ranging/mean-reverting markets.
ATR Target Multiplier: Scales the Take Profit distance relative to recent volatility. 1.5 is a balanced default; tighten for scalping, widen for swing trades.
USAGE NOTES
This indicator works best when sweep signals align with additional confluence — for example, a bullish sweep occurring at a higher-timeframe support zone, a Fair Value Gap, or a daily demand area. The script does not predict reversals; it identifies the structural conditions under which reversals statistically have higher probability.
Always use proper risk management and do not rely on any single indicator in isolation.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.