PROTECTED SOURCE SCRIPT
Updated

HTF Liquidity Sweep Detector

76
An indicator designed to detect liquidity sweeps on Higher Timeframes (HTF), displaying points where price sweeps through the highs or lows of candles on larger timeframes.
Key Features

Supports analysis of 2 timeframes simultaneously (HTF 1 and HTF 2)
Detects both Bullish and Bearish liquidity sweeps
Displays lines and labels with turtle emoji markers
Automatic sweep invalidation system
Customizable line styles, colors, and widths for each HTF
Independent label and turtle emoji display controls
Adjustable label position (Left, Center, Right)
Configurable line extension length
Alert notifications when sweeps are formed

How It Works

Monitors candles on selected higher timeframes
Identifies when price sweeps above previous highs (Bullish Sweep) or below previous lows (Bearish Sweep)
Validates sweep formations and automatically removes invalidated sweeps
Displays sweep lines extending forward with optional labels

Settings
HTF 1 & HTF 2:

Enable/Disable HTF
Timeframe selection
Number of candles to track
Show/Hide sweep lines
Line style (Solid, Dashed, Dotted)
Line width and color
Extend bars length
Show/Hide labels and turtle emojis independently
Label position (Left, Center, Right)
Label size and color

Alerts:

Sweep formation notifications

Use Cases

Identifying liquidity grab zones
Confirming trend reversals
Spotting institutional manipulation patterns
Planning entries after liquidity sweeps
Release Notes
Fixed. Extend bars
Release Notes
Added inv_length input: Set length for invalidated sweep lines (default 50, min 10-200)
max_bars_back=2000: Better historical data handling
Fixed detect_sweeps: Removed min(4) to count-1, dropped not c2.is_closed + size<=2 for full pair detection
Added barstate.isconfirmed: In detect_sweeps to prevent runtime buffer errors
Updated draw_sweep/plot_sweeps: Uses inv_length for short invalidated lines
Release Notes
.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.