Indicator · Pine Script v6 · On the chart

Liquidity Grabs | Flux Charts

by theonetrade· code credited to fluxchart

Calculates buyside and sellside liquidity grabs by monitoring key pivot highs and lows.

View on GitHub

GitHub stars34on the repository
Pine versionv6current
Lines of code124
Settings4inputs
LicenceMIT
Last update2 weeks ago8 Nov 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

124 lines of Pine Script v6 from assets/indicator/bit-exact/liquidity_grabs_flux_charts_ZxHyWlMd.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

liquidity_grabs_flux_charts_ZxHyWlMd.pine
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © fluxchart

//@version=6
const bool DEBUG = false
const int maxDistanceToLastBar = 5000 // Affects Running Time
const bool renderingEnabled = true
indicator(title = 'Liquidity Grabs | Flux Charts', overlay = true)
//#region Liquidity Grabs

const int liqGrabLiqZoneCount = 5
const int bubbleSize = 5
const int liqGrabCooldown = 3

buysideColorGrab = input(#f2364680, "Buyside", inline = "EV", group = "Liquidity Grabs", display = display.none)
sellsideColorGrab = input(#08998180, "Sellside", inline = "EV", group = "Liquidity Grabs", display = display.none)
pivotLenLiqGrab = input.int(25, "Pivot Length", group = "Liquidity Grabs", display = display.none)
WBR = input.float(0.5, "Wick-Body Ratio", step = 0.1, group = "Liquidity Grabs", display = display.none)

invalidateBottomClose = math.min(close, open)
invalidateTopClose = math.max(close, open)
getInvalidationPoint (bool isTop, bool isClose) =>
    if isTop and isClose
        invalidateTopClose
    else if isTop and (not isClose)
        high
    else if (not isTop) and isClose
        invalidateBottomClose
    else
        low

float pivotHighLiqGrab = ta.pivothigh(pivotLenLiqGrab, pivotLenLiqGrab)
float pivotLowLiqGrab = ta.pivotlow(pivotLenLiqGrab, pivotLenLiqGrab)

detectLiquidityGrab () =>
    var buysideLiqs = array.new<float>()
    var sellsideLiqs = array.new<float>()
    var liqsToRemove = array.new<float>()
    series bool _grabFound = false
    series bool _grabBuyside = true
    series int _grabSize = 1

    if not na(pivotHighLiqGrab)
        buysideLiqs.push(pivotHighLiqGrab)
        if buysideLiqs.size() > liqGrabLiqZoneCount
            buysideLiqs.shift()
    if not na(pivotLowLiqGrab)
        sellsideLiqs.push(pivotLowLiqGrab)
        if sellsideLiqs.size() > liqGrabLiqZoneCount
            sellsideLiqs.shift()
    
    for curLiq in buysideLiqs
        if getInvalidationPoint(true, false) > curLiq and getInvalidationPoint(true, true) < curLiq
            bodySize = math.abs(close - open)
            wickSize = (high - math.max(close, open))
            curWBR = wickSize / bodySize
            _grabFound := true
            _grabBuyside := true
            _grabSize := math.floor(math.min(curWBR / WBR, 3))
            liqsToRemove.push(curLiq)
            break
        if getInvalidationPoint(true, true) > curLiq
            liqsToRemove.push(curLiq)
            break
    if (not _grabFound)
        for curLiq in sellsideLiqs
            if getInvalidationPoint(false, false) < curLiq and getInvalidationPoint(false, true) > curLiq
                bodySize = math.abs(close - open)
                wickSize = (math.min(close, open) - low)
                curWBR = wickSize / bodySize
                _grabFound := true
                _grabBuyside := false
                _grabSize := math.floor(math.min(curWBR / WBR, 3))
                liqsToRemove.push(curLiq)
                break
            if getInvalidationPoint(false, true) < curLiq
                liqsToRemove.push(curLiq)
                break

    for liqToRemove in liqsToRemove
        buysideIndex = buysideLiqs.indexof(liqToRemove)
        if buysideIndex != -1
            buysideLiqs.remove(buysideIndex)
            continue
        sellsideIndex = sellsideLiqs.indexof(liqToRemove)
        if sellsideIndex != -1
            sellsideLiqs.remove(sellsideIndex)
    liqsToRemove.clear()

    [_grabFound, _grabBuyside, _grabSize]

buysideLiqGrabSmall = false
buysideLiqGrabMedium = false
buysideLiqGrabLarge = false
sellsideLiqGrabSmall = false
sellsideLiqGrabMedium = false
sellsideLiqGrabLarge = false
var lastBuysideGrab = 0
var lastSellsideGrab = 0
liqGrabCooldownOK = false
if (last_bar_index - bar_index) < maxDistanceToLastBar and barstate.isconfirmed
    [_grabFound, _grabBuyside, _grabSize] = detectLiquidityGrab()
    liqGrabCooldownOK := ((_grabBuyside and (bar_index - lastBuysideGrab) > liqGrabCooldown) or ((not _grabBuyside) and (bar_index - lastSellsideGrab) > liqGrabCooldown))
    if _grabFound and _grabSize > 0
        buysideLiqGrabSmall := _grabBuyside and (_grabSize == 1)
        buysideLiqGrabMedium := _grabBuyside and (_grabSize == 2)
        buysideLiqGrabLarge := _grabBuyside and (_grabSize == 3)
        sellsideLiqGrabSmall := (not _grabBuyside) and (_grabSize == 1)
        sellsideLiqGrabMedium := (not _grabBuyside) and (_grabSize == 2)
        sellsideLiqGrabLarge := (not _grabBuyside) and (_grabSize == 3)
        if liqGrabCooldownOK
            lastBuysideGrab := _grabBuyside ? bar_index : lastBuysideGrab
            lastSellsideGrab := _grabBuyside ? lastSellsideGrab : bar_index

plot((buysideLiqGrabSmall and renderingEnabled and liqGrabCooldownOK) ? high : na, "Buyside Liq Grab Small", buysideColorGrab, bubbleSize, plot.style_circles, false, 0, display = display.pane)
plot((buysideLiqGrabMedium and renderingEnabled and liqGrabCooldownOK) ? high : na, "Buyside Liq Grab Medium", buysideColorGrab, int(bubbleSize * 1.5), plot.style_circles, false, 0, display = display.pane)
plot((buysideLiqGrabLarge and renderingEnabled and liqGrabCooldownOK) ? high : na, "Buyside Liq Grab Large", buysideColorGrab, bubbleSize * 2, plot.style_circles, false, 0, display = display.pane)
plot((sellsideLiqGrabSmall and renderingEnabled and liqGrabCooldownOK) ? low : na, "Sellside Liq Grab Small", sellsideColorGrab, bubbleSize, plot.style_circles, false, 0, display = display.pane)
plot((sellsideLiqGrabMedium and renderingEnabled and liqGrabCooldownOK) ? low : na, "Sellside Liq Grab Medium", sellsideColorGrab, int(bubbleSize * 1.5), plot.style_circles, false, 0, display = display.pane)
plot((sellsideLiqGrabLarge and renderingEnabled and liqGrabCooldownOK) ? low : na, "Sellside Liq Grab Large", sellsideColorGrab, bubbleSize * 2, plot.style_circles, false, 0, display = display.pane)
//#endregion

alertcondition((buysideLiqGrabSmall or buysideLiqGrabMedium or buysideLiqGrabLarge) and barstate.isconfirmed, "Buyside Liquidity Grab @ {{ticker}}", "Buyside Liquidity Grab @ {{ticker}}")
alertcondition((sellsideLiqGrabSmall or sellsideLiqGrabMedium or sellsideLiqGrabLarge) and barstate.isconfirmed, "Sellside Liquidity Grab @ {{ticker}}", "Sellside Liquidity Grab @ {{ticker}}")

Overview

The indicator tracks recent pivot levels in arrays and flags a liquidity grab when a candle wick pierces a level while the candle body remains on the opposite side, filtered by a configurable wick-to-body ratio. Key settings allow customization of the pivot detection length, minimum wick-to-body ratio, and visual colors for buyside and sellside grabs. All visual markers are drawn directly on the main price chart.

Details

Published by

theonetrade on GitHub

Code credit

fluxchart, as written in the script's header

Draws

On the price chart

Markets

Any symbol

Timeframes

Any timeframe

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

algorithmic-tradingbacktestingbitcoinccxtcrypto-tradingllm-agentoffline-backtestingopen-source-tradingpine-scriptpine-to-pythonpinescriptpynecorepythonquantquantitative-financestrategy-backtestingtechnical-analysistrading-indicatorstrading-strategiestradingview

Settings

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

SettingTypeDefaultVariable
Buysidecolor#f2364680buysideColorGrab
Sellsidecolor#08998180sellsideColorGrab
Pivot Lengthint25pivotLenLiqGrab
Wick-Body Ratiofloat0.5WBR
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

ICT Equal Highs and Lows

by ArunKBhaskar
575 stars

This overlay indicator finds pivot highs and lows on the price chart and compares the last two highs and the last two lows. When the percentage difference between a pair is below the Equal HL threshold, it treats them as equal levels and draws a box. Left and

Indicator v5 SMC / ICT / price actionSupport & resistance
Updated 1 year ago · MPL-2.0 GitHub repository of ICT Equal Highs and Lows

DE-tracker

by Allen1212
302 stars

This indicator plots labels on the TradingView price chart to mark ARK Invest's buy and sell trades for the DE stock. Buy transactions appear in green with X1 or X2 multipliers showing the number of ARK ETFs involved on the same day; sells appear in red. The m

Indicator v4 Support & resistanceSMC / ICT / price action
Updated 3 years ago · None stated GitHub repository of DE-tracker

This Pine Script indicator plots a ZigZag on the price chart. It identifies reversal points when price moves more than a set percentage from the last pivot. The script calculates forecasts using zigzag data and labels detected geometric patterns including harm

Indicator v4 TrendSupport & resistance

Golden Bullet Strategy

by TradersPost
228 stars

The Golden Bullet Strategy is an overlay signal indicator based on Smart Money Concepts and time-based liquidity models. It identifies liquidity sweeps of a designated reference session range during a specified hunt window. It then confirms Market Structure Sh

Indicator v6 SMC / ICT / price actionSessions & time
Updated 4 months ago · None stated GitHub repository of Golden Bullet Strategy

Open Source Fractal

by cantolab
183 stars

This indicator implements the Fractal Model concept to plot market structure shifts, liquidity sweeps, and Change in State of Delivery (CISD) levels. It overlays custom higher-timeframe candle previews, open prices, and time markers directly on the price chart

Indicator v6 SMC / ICT / price actionSupport & resistance
Updated 3 months ago · MIT GitHub repository of Open Source Fractal

Swing Failure Signals

by Ganador1
154 stars

This indicator calculates pivot highs and pivot lows to detect liquidity sweeps and Swing Failure Patterns. It identifies when price breaks past recent key swing highs or lows within a configurable historical window, then looks for a quick reversal or change i

Indicator v6 SMC / ICT / price actionSupport & resistance
Updated 3 months ago · Apache-2.0 GitHub repository of Swing Failure Signals

More Support & resistance scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

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

Compare brokers