OPEN-SOURCE SCRIPT

Sweep Detector v2

180
Updates in This Version:
  • New Condition: Higher Timeframe Body Sweep
    - If a candle closes beyond a previous swing high/low and the next candle closes back inside, it is now counted as a sweep.
    - This helps detect sweeps that would be visible on a higher timeframe.
  • Updated Markers and Lines
    - The indicator now marks and draws lines for both wick-based and body-based sweeps.


Sweep Detector - Description

The Sweep Detector is a Pine Script indicator designed to identify liquidity sweeps in price action. It detects when price breaks a previous swing high or low but fails to hold above/below that level, signaling potential reversals.

How It Works:
  • Swing High & Swing Low Detection
    - The script identifies swing highs and swing lows based on a simple three-bar pattern.
    - A swing high occurs when a candle’s high is higher than both the previous and next candle’s highs.
    - A swing low occurs when a candle’s low is lower than both the previous and next candle’s lows.

  • Wick Sweep Condition
    - A high sweep is detected when price wicks above the previous swing high but closes back below it.
    - A low sweep is detected when price wicks below the previous swing low but closes back above it.

  • Visual Indicators
    - Red downward markers appear above candles that trigger a high sweep.
    - Green upward markers appear below candles that trigger a low sweep.
    - Lines are drawn from previous swing levels to the candle that sweeps them for clear visualization.


Use Case:
  • This indicator helps traders spot potential liquidity grabs, stop hunts, or reversal zones based on price action.
  • It can be used on various timeframes for scalping, day trading, or swing trading strategies.

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.