Indicator · Pine Script v6 · On the chart

Capital41 Liquidity Sweep Simple

by damianpitt· code credited to Capital41 | MIT License

The Capital41 Liquidity Sweep Simple indicator detects liquidity sweeps where price breaks a recent swing high or low then closes back inside the range with volume confirmation.

View on GitHub

GitHub stars6on the repository
Pine versionv6current
Lines of code113
Settings5inputs
LicenceMIT
Last update8 weeks ago31 Aug 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

113 lines of Pine Script v6 from Capital41_Liquidity_Sweep/Capital41_Liquidity_Sweep_Simple.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

Capital41_Liquidity_Sweep_Simple.pine
// Copyright (c) 2026 Capital41 | MIT License
// CAPITAL41 LIQUIDITY SWEEP SIMPLE

// What it does:
// - Detects liquidity sweeps where price breaks a recent swing level and closes
//   back inside the range with above-average volume.
// - Marks single sweeps and optional consecutive sweeps at similar levels.
// - Non-repainting: signals only after bar close.
//
// TradingView setup:
// 1) Open TradingView -> Pine Editor.
// 2) Paste this script, Save, and Add to chart.
// 3) Use 30m or 4h on BTC or US stocks.
// 4) Adjust inputs if you want more or fewer signals.
//
// Usage guide (30m/4h):
// - Long: bullish sweep near support or in a bullish HTF trend.
// - Short: bearish sweep near resistance or in a bearish HTF trend.
// - For more signals: lower Min volume ratio or Lookback bars.
// - For fewer signals: raise Min volume ratio or Lookback bars.



//@version=6
indicator("Capital41 Liquidity Sweep Simple", overlay = true, max_labels_count = 50)

// Inputs tuned for 30m-4H
lenHighLow       = input.int(20, "Lookback bars", minval = 2)
volLookback      = input.int(50, "Volume SMA length", minval = 5)
minVolRatio      = input.float(1.2, "Min volume ratio", minval = 1.0, maxval = 3.0)
trackConsecutive = input.bool(true, "Show high-prob sweeps")
maxBarsBetween   = input.int(10, "Max bars between sweeps", minval = 1, maxval = 100)

colorBull = color.new(color.lime, 0)
colorBear = color.new(color.red, 0)

// Reference levels
priorHigh = ta.highest(high[1], lenHighLow)
priorLow  = ta.lowest(low[1],  lenHighLow)

// Volume filter
volSma   = ta.sma(volume, volLookback)
volRatio = volSma > 0 ? volume / volSma : 0
highVol  = volRatio >= minVolRatio

// Sweep logic (confirmed close back inside range)
bullSweep = low < priorLow and close >= priorLow and highVol and barstate.isconfirmed
bearSweep = high > priorHigh and close <= priorHigh and highVol and barstate.isconfirmed

// Consecutive sweeps at similar level within a window
var int   consecBull = 0
var int   consecBear = 0
var float lastBullLevel = na
var float lastBearLevel = na
var int   lastBullBar = na
var int   lastBearBar = na


tolerance = close * 0.005
sameLevelBull  = not na(lastBullLevel) and math.abs(priorLow - lastBullLevel) <= tolerance
sameLevelBear  = not na(lastBearLevel) and math.abs(priorHigh - lastBearLevel) <= tolerance
withinBarsBull = not na(lastBullBar) and bar_index - lastBullBar <= maxBarsBetween
withinBarsBear = not na(lastBearBar) and bar_index - lastBearBar <= maxBarsBetween

if bullSweep
    if sameLevelBull and withinBarsBull
        consecBull += 1
    else
        consecBull := 1
    lastBullLevel := priorLow
    lastBullBar := bar_index

if bearSweep
    if sameLevelBear and withinBarsBear
        consecBear += 1
    else
        consecBear := 1
    lastBearLevel := priorHigh
    lastBearBar := bar_index

highProbBull = bullSweep and consecBull >= 2
highProbBear = bearSweep and consecBear >= 2

// Signals
plotshape(bullSweep and not highProbBull, title = "Bullish Sweep",
          style = shape.triangleup, location = location.belowbar,
          color = colorBull, size = size.tiny, text = "L")

plotshape(bearSweep and not highProbBear, title = "Bearish Sweep",
          style = shape.triangledown, location = location.abovebar,
          color = colorBear, size = size.tiny, text = "S")

plotshape(highProbBull and trackConsecutive, title = "High-Prob Bullish Sweep",
          style = shape.diamond, location = location.belowbar,
          color = colorBull, size = size.tiny, text = "L")

plotshape(highProbBear and trackConsecutive, title = "High-Prob Bearish Sweep",
          style = shape.diamond, location = location.abovebar,
          color = colorBear, size = size.tiny, text = "S")


// Alerts
alertcondition(bullSweep, title = "Bullish Sweep",
               message = "Liquidity Sweep: bullish sweep on {{ticker}} ({{interval}})")

alertcondition(bearSweep, title = "Bearish Sweep",
               message = "Liquidity Sweep: bearish sweep on {{ticker}} ({{interval}})")

alertcondition(highProbBull and trackConsecutive, title = "High-Prob Bullish Sweep",
               message = "Liquidity Sweep: high-prob bullish sweep on {{ticker}} ({{interval}})")

alertcondition(highProbBear and trackConsecutive, title = "High-Prob Bearish Sweep",
               message = "Liquidity Sweep: high-prob bearish sweep on {{ticker}} ({{interval}})")

Overview

Capital41 Liquidity Sweep Simple plots triangular shapes below the bar for bullish sweeps and above for bearish sweeps, along with diamonds for high-probability consecutive sweeps at similar levels. Main settings adjust lookback bars for swing detection, volume SMA length, minimum volume ratio, and consecutive sweep tracking. It draws signals directly on the price chart. The script is non-repainting with signals confirmed only after the bar closes.

Details

Published by

damianpitt on GitHub

Code credit

Capital41 | MIT License, as written in the script's header

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

SMC / ICT / price action, Support & resistance, Volume

Markets

Crypto, Stocks

Timeframes

M15-H1, H4 and above

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

cryptoindicatorsmarket-structureorder-blockspinescriptsmart-moneytechnical-analysistechnical-analysis-indicatorstradingtradingview

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Lookback barsint20lenHighLow
Volume SMA lengthint50volLookback
Min volume ratiofloat1.2minVolRatio
Show high-prob sweepsbooltruetrackConsecutive
Max bars between sweepsint10maxBarsBetween
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

Moon Dev GEX Sweep & CVD

by moondevonyt
92 stars

The indicator detects liquidity sweeps across key price levels and calculates a cumulative volume delta proxy. It uses pivot high and low lookbacks to identify swing points, marking sweeps when price breaks beyond a level and quickly closes back inside. Featur

Indicator v5 Support & resistanceSMC / ICT / price action
Updated 8 weeks ago · Custom licence GitHub repository of Moon Dev GEX Sweep & CVD

Calculates higher-timeframe volume profiles to identify Value Area High (VAH), Value Area Low (VAL), and Point of Control (POC) levels directly on the price chart. It flags potential reversal setups and Change in State of Delivery (CISD) patterns relative to v

Indicator v6 VolumeSupport & resistance
Updated 2 months ago · None stated GitHub repository of CandelaCharts - Value Area Reversals

Copilot

by milocaetano
48 stars

Copilot is an order flow range-reversal indicator designed to overlay trading setups directly on the price chart. It evaluates four criteria: market context (sideways vs trending regime based on ATR height), structure (double top or double bottom retests), abs

Indicator v5 SMC / ICT / price actionSupport & resistance
Updated yesterday · MIT GitHub repository of Copilot

Supply and Demand Visible Range identifies supply, demand, and equilibrium zones across the visible chart range. It accumulates high, low, and volume data starting from the leftmost visible bar, optionally requesting lower timeframe intrabar data for finer res

Indicator v5 Support & resistanceVolume Repaints
Updated 2 months ago · AGPL-3.0 GitHub repository of Supply and Demand Visible Range [LuxAlgo]
13 stars

This script identifies and visualizes bullish and bearish order blocks on the price chart. It detects low-volatility consolidation ranges followed by breakout moves accompanied by high trading volume. Users can select between Simple, Relative, or Weighted volu

Indicator v6 SMC / ICT / price actionSupport & resistance
Updated 6 months ago · MIT GitHub repository of Advanced Order Blocks with Volume

This indicator identifies and visualizes key support and resistance heatmap zones directly on the price chart. Using closed one-hour price data, it evaluates multi-scale pivots, liquidity clusters, relative volume, and round-number resonances to score structur

Indicator v6 Support & resistanceSMC / ICT / price action
Updated 7 weeks ago · MIT GitHub repository of 加密货币1小时关键价位热力图 V2

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers