OPEN-SOURCE SCRIPT

Liquidity Sweep Quality Engine [algotim]

1 275
Liquidity Sweep Engine with Quality Scoring is a liquidity-based market structure indicator designed to identify confirmed sweep events around previously established swing highs and swing lows.

Rather than treating every sweep as equally important, the script evaluates each event through a multi-factor validation framework that measures penetration depth, rejection quality, participation, and displacement. The result is a ranked sweep signal that helps separate meaningful liquidity events from routine market noise.

In addition to sweep detection, the indicator creates post-sweep memory zones that allow traders to monitor areas where significant liquidity interactions previously occurred.

Problem Statement
Many liquidity sweep tools generate signals whenever price briefly trades beyond a recent high or low. While these events occur frequently, a large percentage are minor volatility spikes that provide little analytical value.

This script was created to address that problem by introducing a structured quality assessment process.

Instead of asking:

"Did price sweep a level?"

the indicator asks:

"How meaningful was the sweep?"

Only sweeps that demonstrate sufficient penetration, rejection, participation, and displacement receive higher quality scores and stronger visual emphasis.

Methodology
The indicator begins by identifying confirmed swing highs and swing lows using pivot-based structure detection. These levels are stored as active liquidity levels and remain valid until they are swept or expire due to age.

When price interacts with one of these levels, the script evaluates whether a valid liquidity sweep has occurred:

Buy-Side Liquidity Sweep (BSL)
A buy-side sweep occurs when price trades above a confirmed swing high but closes back below that level.

Sell-Side Liquidity Sweep (SSL)
A sell-side sweep occurs when price trades below a confirmed swing low but closes back above that level.

Each detected sweep is then evaluated using the Sweep Quality Score engine.

Signal Workflow
Step 1 — Liquidity Level Registration
Confirmed pivot highs and lows are stored as active liquidity levels. Older levels automatically expire after the user-defined memory period.

Step 2 — Sweep Detection
The script monitors active liquidity levels for sweep conditions:
High exceeds swing high and closes back below.
Low exceeds swing low and closes back above.

Step 3 — Quality Scoring
Each sweep receives a score from 0 to 4.
The score consists of four independent components:
ATR-normalized wick penetration.
ATR-normalized rejection strength.
Volume confirmation above a moving-average threshold.
Body displacement confirmation relative to the prior candle.

Step 4 — Classification
Sweeps are classified as:
Weak
Qualified
Elite (SQS = 4)
depending on their final score.

Step 5 — Memory Zone Creation

After a sweep is confirmed, optional memory zones can be created and extended forward to highlight areas where liquidity was previously taken. These zones can gradually fade as they age.

Why This Indicator Is Different
Many liquidity indicators stop at detecting whether a level was breached.
This script adds a validation framework that attempts to measure the quality of the breach itself.

Key differences include:
Multi-factor sweep ranking instead of binary detection.
ATR-normalized measurements for penetration and rejection.
Optional volume participation validation.
Body displacement confirmation.
Active liquidity level lifecycle management.
Post-sweep memory zones for future reference.

The objective is not simply to show where liquidity was taken, but to highlight which sweep events displayed stronger evidence of rejection and participation.

Inputs
Liquidity Pool Detection
Swing Length
Level Memory
Sweep Quality Filters
Minimum Quality Score
ATR Length
Minimum Wick Penetration
Minimum Rejection Strength
Volume Confirmation
Volume Threshold
Volume Moving Average Length
Memory Zones
Show Memory Zones
Zone Depth
Zone Lifespan
Fade Zones
Visual Settings
Active Liquidity Levels
Sweep Labels
Weak Sweep Display
Level Extension
Colors

Separate color controls for:
Buy-side sweeps
Sell-side sweeps
Active levels
Memory zones

Alerts
The script includes alert conditions for:
Buy-Side Liquidity Sweep
Sell-Side Liquidity Sweep
Highest Quality Sweep (SQS = 4)
Any Qualified Sweep

Practical Usage
A common workflow is:
Allow the indicator to build a map of active liquidity levels.
Monitor sweeps occurring at those levels.
Prioritize higher SQS events over lower-quality sweeps.
Use memory zones to track future interactions around previously swept areas.
Combine sweep information with broader market structure, trend analysis, or risk management frameworks.

Limitations
Pivot-based levels require confirmation and therefore appear after the pivot has formed.
Liquidity sweeps do not guarantee reversals.
Volume-based scoring may behave differently on instruments with limited volume data.
High-volatility environments can still generate additional sweep activity.
Memory zones highlight historical reactions and should not be interpreted as future price predictions.

Notes
This indicator is a chart analysis tool designed to evaluate liquidity sweep behavior through a structured scoring framework. The output is intended to help organize and rank liquidity events, not to provide standalone trade recommendations.

免責事項

これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。