OPEN-SOURCE SCRIPT

Liquidity Sweep Filter Strategy [AlgoAlpha X PineIndicators]

379
This strategy is based on the Liquidity Sweep Filter developed by AlgoAlpha. Full credit for the concept and original indicator goes to AlgoAlpha.

The Liquidity Sweep Filter Strategy is a non-repainting trading system designed to identify liquidity sweeps, trend shifts, and high-impact price levels. It incorporates volume-based liquidation analysis, trend confirmation, and dynamic support/resistance detection to optimize trade entries and exits.

This strategy helps traders:
  • Detect liquidity sweeps where major market participants trigger stop losses and liquidations.
  • Identify trend shifts using a volatility-based moving average system.
  • Analyze volume distribution with a built-in volume profile visualization.
  • Filter noise by differentiating between major and minor liquidity sweeps.


How the Liquidity Sweep Filter Strategy Works
1. Trend Detection Using Volatility-Based Filtering
The strategy applies a volatility-adjusted moving average system to determine trend direction:
  • A central trend line is calculated using an EMA smoothed over a user-defined length.
  • Upper and lower deviation bands are created based on the average price deviation over multiple periods.
  • If price closes above the upper band, the strategy signals an uptrend.
  • If price closes below the lower band, the strategy signals a downtrend.


This approach ensures that trend shifts are confirmed only when price significantly moves beyond normal market fluctuations.

2. Liquidity Sweep Detection
Liquidity sweeps occur when price temporarily breaks key levels, triggering stop-loss liquidations or margin call events. The strategy tracks swing highs and lows, marking potential liquidity grabs:

  • Bearish Liquidity Sweeps – Price breaks a recent high, then reverses downward.
  • Bullish Liquidity Sweeps – Price breaks a recent low, then reverses upward.
  • Volume Integration – The strategy analyzes trading volume at each sweep to differentiate between major and minor sweeps.


Key levels where liquidity sweeps occur are plotted as color-coded horizontal lines:
  • Red lines indicate bearish liquidity sweeps.
  • Green lines indicate bullish liquidity sweeps.


Labels are displayed at each sweep, showing the volume of liquidated positions at that level.

3. Volume Profile Analysis
The strategy includes an optional volume profile visualization, displaying how trading volume is distributed across different price levels.

Features of the volume profile:
  • Point of Control (POC) – The price level with the highest traded volume is marked as a key area of interest.
  • Bounding Box – The profile is enclosed within a transparent box, helping traders visualize the price range of high trading activity.
  • Customizable Resolution & Scale – Traders can adjust the granularity of the profile to match their preferred time frame.


The volume profile helps identify zones of strong support and resistance, making it easier to anticipate price reactions at key levels.

Trade Entry & Exit Conditions
The strategy allows traders to configure trade direction:
  • Long Only – Only takes long trades.
  • Short Only – Only takes short trades.
  • Long & Short – Trades in both directions.


Entry Conditions
  • Long Entry:

    A bullish trend shift is confirmed.
    A bullish liquidity sweep occurs (price sweeps below a key level and reverses).
    The trade direction setting allows long trades.
  • Short Entry:

    A bearish trend shift is confirmed.
    A bearish liquidity sweep occurs (price sweeps above a key level and reverses).
    The trade direction setting allows short trades.

Exit Conditions
  • Closing a Long Position:

    A bearish trend shift occurs.
    The position is liquidated at a predefined liquidity sweep level.
  • Closing a Short Position:

    A bullish trend shift occurs.
    The position is liquidated at a predefined liquidity sweep level.

Customization Options
The strategy offers multiple adjustable settings:
  • Trade Mode: Choose between Long Only, Short Only, or Long & Short.
  • Trend Calculation Length & Multiplier: Adjust how trend signals are calculated.
  • Liquidity Sweep Sensitivity: Customize how aggressively the strategy identifies sweeps.
  • Volume Profile Display: Enable or disable the volume profile visualization.
  • Bounding Box & Scaling: Control the size and position of the volume profile.
  • Color Customization: Adjust colors for bullish and bearish signals.


Considerations & Limitations
  • Liquidity sweeps do not always result in reversals. Some price sweeps may continue in the same direction.
  • Works best in volatile markets. In low-volatility environments, liquidity sweeps may be less reliable.
  • Trend confirmation adds a slight delay. The strategy ensures valid signals, but this may result in slightly later entries.
  • Large volume imbalances may distort the volume profile. Adjusting the scale settings can help improve visualization.


Conclusion
The Liquidity Sweep Filter Strategy is a volume-integrated trading system that combines liquidity sweeps, trend analysis, and volume profile data to optimize trade execution.

By identifying key price levels where liquidations occur, this strategy provides valuable insight into market behavior, helping traders make better-informed trading decisions.

Key use cases for this strategy:
  • Liquidity-Based Trading – Capturing moves triggered by stop hunts and liquidations.
  • Volume Analysis – Using volume profile data to confirm high-activity price zones.
  • Trend Following – Entering trades based on confirmed trend shifts.
  • Support & Resistance Trading – Using liquidity sweep levels as dynamic price zones.


This strategy is fully customizable, allowing traders to adapt it to different market conditions, timeframes, and risk preferences.

Full credit for the original concept and indicator goes to AlgoAlpha.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.