OPEN-SOURCE SCRIPT

Liquidity Sweep Detector [QuantAlgo]

11 022
🟢 Overview

The Liquidity Sweep Detector is a swing-based liquidity tracking tool that identifies moments when price wicks beyond a confirmed swing high or low and closes back inside, then tracks the remaining unswept levels as forward-projecting lines and zones on your chart. It classifies each event by direction (Bullish or Bearish) and maintains a running registry of swing levels that have not yet been visited by price, giving you a live map of where resting stop clusters may still be sitting across any timeframe and market.
снимок
🟢 How It Works

The indicator identifies swing highs and lows using a pivot detection window that requires a configurable number of bars to the left and right to confirm a valid structural point. The active pivot length and minimum wick penetration are resolved from the selected preset before any detection runs:
Pine Script®

снимок
A bearish sweep is confirmed when price wicks above the most recent swing high by at least the minimum penetration percentage and closes back below it. A bullish sweep mirrors this on the downside:
Pine Script®

снимок
Every confirmed swing point is simultaneously stored in an unswept level registry. Levels are removed when the full candle closes beyond them, or immediately when a sweep is confirmed on that level, so the chart only shows levels price has not yet visited:
Pine Script®

снимок
The indicator also detects when price enters the zone around an unswept level without yet confirming a full sweep. Edge detection ensures the alert fires once on entry rather than on every bar price remains inside the zone:
Pine Script®

снимок
🟢 Key Features

▶ Three Preset Configurations: The indicator includes three presets that override the manual pivot length and minimum wick penetration settings.

1. Default/Custom: A general-purpose configuration suited to swing trading on 4H and daily charts. Confirms swing points that require a reasonable structural context before a sweep is flagged.

2. Scalp: A faster configuration for intraday charts from 1 minute to 15 minutes. Shorter pivot windows capture local swing points that form and get swept within a single session.

3. Swing: A more conservative configuration for daily and weekly charts that requires a more deliberate wick extension before confirming a sweep, filtering out shallow tags at swing levels.
снимок
▶ Built-in Alert System: Pre-configured alert conditions cover bearish sweeps, bullish sweeps, any sweep, price entering a buy-side zone, price entering a sell-side zone, and price entering any unswept zone.
снимок
▶ Visual Customisation: Choose from five colour presets (Classic, Aqua, Cosmic, Cyber, Neon) or set your own custom colours. Optional candle background highlighting marks sweep bars directly on the chart, and label text size is configurable across four options to suit different chart layouts.
снимок
🟢 Important Considerations

▶ Sweep detection references only the most recently confirmed swing high or low at the time each bar closes. On lower timeframes with frequent swing formation, raising the pivot length focuses detection on more structurally significant levels and reduces signal frequency on choppy charts.

▶ The indicator works best as a contextual layer within an existing trading framework. Sweep signals indicate that price has moved beyond a swing level and closed back inside, which is a useful data point, but should be read alongside your system and market context rather than used as a standalone trigger.

Отказ от ответственности

Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.