Indicator · Pine Script v6 · On the chart

Liquidity Sweep + Close-Back Confirmation

by Ahmed-GoCode· code credited to Ahmed - Quant-Edge Indicators

This Pine Script indicator identifies liquidity sweeps and confirms signals using a close-back candle pattern directly on the price chart.

View on GitHub

GitHub stars53on the repository
Pine versionv6current
Lines of code51
Settings5inputs
LicenceMPL-2.0
Last update2 months ago17 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

51 lines of Pine Script v6 from Quant-Edge-Indicators/Smart Money & Liquidity/Trio Liquidity.pinescript, published under MPL-2.0. Keep the author's credit and licence lines when you reuse it.

Trio Liquidity.pinescript
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Ahmed - Quant-Edge Indicators
//@version=6
indicator("Liquidity Sweep + Close-Back Confirmation", overlay = true, max_boxes_count = 50, max_labels_count = 50)

// ==== Inputs ====
swingLookback = input.int(10, "Swing Lookback (bars)", minval = 2)
showBoxes     = input.bool(true, "Show sweep boxes")
showLabels    = input.bool(true, "Show Buy/Sell labels")
buyColor      = input.color(color.new(color.teal, 70), "Buy box color")
sellColor     = input.color(color.new(color.red, 80), "Sell box color")

// ==== Pattern detection ====
// confirmation candle = current bar (bar_index), sweep candle = 1 bar back
sweepLow   = low[1]
sweepHigh  = high[1]

// swing reference BEFORE the sweep candle: lowest low / highest high over the lookback window, starting 2 bars back
swingLow  = ta.lowest(low, swingLookback)[2]
swingHigh = ta.highest(high, swingLookback)[2]

bullSignal = sweepLow < swingLow and close > sweepHigh
bearSignal = sweepHigh > swingHigh and close < sweepLow

// ==== Plot arrows ====
plotshape(bullSignal, title = "Buy Signal", style = shape.triangleup,
     location = location.belowbar, color = color.teal, size = size.small)
plotshape(bearSignal, title = "Sell Signal", style = shape.triangledown,
     location = location.abovebar, color = color.red, size = size.small)

// ==== Boxes over the sweep candle ====
if showBoxes and bullSignal
    box.new(bar_index[1], sweepHigh, bar_index, sweepLow,
         border_color = color.teal, bgcolor = buyColor, border_width = 1)

if showBoxes and bearSignal
    box.new(bar_index[1], sweepHigh, bar_index, sweepLow,
         border_color = color.red, bgcolor = sellColor, border_width = 1)

// ==== Labels ====
if showLabels and bullSignal
    label.new(bar_index, low, "BUY", style = label.style_label_up,
         color = color.teal, textcolor = color.white, size = size.small, yloc = yloc.belowbar)

if showLabels and bearSignal
    label.new(bar_index, high, "SELL", style = label.style_label_down,
         color = color.red, textcolor = color.white, size = size.small, yloc = yloc.abovebar)

// ==== Alerts ====
alertcondition(bullSignal, title = "Liquidity Sweep Buy", message = "{{ticker}} {{interval}}: Liquidity sweep BUY confirmed at {{close}}")
alertcondition(bearSignal, title = "Liquidity Sweep Sell", message = "{{ticker}} {{interval}}: Liquidity sweep SELL confirmed at {{close}}")

Overview

Liquidity Sweep + Close-Back Confirmation tracks recent swing highs and lows over a customizable lookback period. A bullish signal forms when a prior bar sweeps below a swing low and the current bar closes above that sweep bar's high. A bearish signal triggers when a bar sweeps above a swing high and the current bar closes below its low. Settings allow traders to toggle signal labels, visual sweep boxes, and display colors.

Details

Published by

Ahmed-GoCode on GitHub

Code credit

Ahmed - Quant-Edge Indicators, as written in the script's header

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

SMC / ICT / price action, Support & resistance, Candlestick patterns

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

fair-value-gapfibonaccimarket-structurepine-scriptrsi-strategysmart-money-conceptstechnical-analysistradingviewalgorithmic-tradingcrypto-trading

Settings

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

SettingTypeDefaultVariable
Swing Lookback (bars)int10swingLookback
Show sweep boxesbooltrueshowBoxes
Show Buy/Sell labelsbooltrueshowLabels
Buy box colorcolorcolor.new(color.teal, 70)buyColor
Sell box colorcolorcolor.new(color.red, 80)sellColor
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

46 stars

This overlay indicator draws a set of higher-timeframe candles on the price chart. The user sets the timeframe or lets it select automatically, plus candle count, size, offset, margin, and whether the candles are standard or Heikin Ashi. A table can show the a

Indicator v6 Support & resistanceCandlestick patterns Repaints
Updated 7 weeks ago · None stated GitHub repository of HTF Sweep Model with CISD Table

Fractal Reclaim Strength

by selimgrsoy0-commits
12 stars

The indicator tracks four-bar fractal sweep and reclaim setups on chart timeframes of 15 minutes and above. It calculates Reclaim Strength based on where C2 closes relative to C1's range and plots level lines for the swept C1 extreme and C2 extreme. An on-scre

Indicator v6 SMC / ICT / price actionSupport & resistance
Updated 7 weeks ago · None stated GitHub repository of Fractal Reclaim Strength

ICT HTF Candles (fadi)

by dbruce1990
12 stars

ICT HTF Candles displays higher timeframe candle structures directly on the price chart using customized boxes and lines. It tracks up to six user-defined higher timeframes, plotting historical body, wick, and imbalance zones alongside optional price level tra

Indicator v6 SMC / ICT / price actionCandlestick patterns
Updated 1 year ago · None stated GitHub repository of ICT HTF Candles (fadi)

This overlay indicator detects tweezer tops and bottoms and kangaroo-tail pin bars, then draws supply and demand zones from those patterns. It scores each zone, decays freshness, merges overlapping zones, and can invalidate a zone after a close-through or afte

Indicator v6 Candlestick patternsSupport & resistance
Updated yesterday · MIT GitHub repository of Tweezer & Kangaroo Zones [WavesUnchained]
7 stars

This indicator plots Smart Money Concepts and price action components directly on the price chart. It highlights bullish and bearish order blocks, multi-timeframe pivot points, market structure swings with key Fibonacci retracement levels (0.618 and 0.786), zo

Indicator v5 SMC / ICT / price actionSupport & resistance Repaints
Updated 3 months ago · None stated GitHub repository of Cryptokazancev Strategy Pack

3-Candle Time Pattern

by alboogycOdR
6 stars

This indicator detects three-candle time patterns on the price chart, tracking range, manipulation, and distribution phases based on Smart Money Concepts. It establishes high and low boundaries from the opening candle and identifies boundary rejections during

Indicator v5 SMC / ICT / price actionCandlestick patterns
Updated 7 months ago · None stated GitHub repository of 3-Candle Time Pattern

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