Free OHLC detector · Pine Script v6 example

TradingView Liquidity Sweep Indicator & Detector

A liquidity sweep indicator marks a breach of a reference high or low followed by a close back across that level. The best fit depends on when pivots become known, how levels expire, and when alerts fire. Inspect those rules with the free detector below; OHLC prices cannot prove resting orders or institutional intent.

Interactive Browser Sweep Simulator

Paste raw OHLC bars to test pivot lookback parameters and sweep confirmation rules. Sample prices are synthetic; enter only completed bars.

20 bars parsed successfully. Supports comma or tab delimiters.

Pivot Confirmation: In live trading, a swing level requires 2 subsequent bars to form before it is confirmed. Confirm Bars adds 1 more closed bars after a sweep; results show both timestamps.

Detected Liquidity Sweeps

Total: 1
BSL Sweep (Highs)
Level 111.00 · sweep #11 · known #12

Historical levels & sweep bars

Swing Highs Swing Lows

Dashed lines summarize historical pivot prices across the chart; they do not show when levels became available. Shading marks the sweep bar, not its later confirmation.

How to choose a liquidity sweep indicator for TradingView

Compare observable rules before comparing chart screenshots. We have not run a head-to-head performance study, so this is a selection checklist rather than a ranked list of winners.

CriterionWhat to verifyThis example
Reference levelSwing pivots, equal highs/lows, or session extremes?Latest strict swing high and low. Equal-price pivots are excluded.
Confirmation delayWhen was the level actually known?After Right Bars close. No partial window at the dataset edges.
Sweep ruleMust the same candle reclaim the level?Strict breach and same-bar close back inside; equality is not a reclaim.
Level expiryCan a consumed or broken level trigger repeatedly?First strict breach consumes it. A newer confirmed pivot replaces it.
Alerts and accessCan you inspect the logic and reproduce alert timing?Code is visible below; alerts run at bar close after you create one in TradingView.

An open-source indicator is easier to audit. For protected or invite-only scripts, ask the author for these rules and compare forward observations with the historical display. Additional filters may change signal frequency; they do not establish better returns.

For reference levels calculated from a completed session instead of local swings, compare the pivot point calculator. The level definition changes which bars qualify as breaches.

Sweep, breakout, and liquidity void are different labels

For a high at 100, a later bar with high 101 and close 99 meets this detector's high-sweep rule. High 101 and close 100.5 does not. This second bar consumes the level as a failed reclaim; the code does not later reuse it to manufacture a sweep. The low-side rule is symmetric.

A close outside the level is a breakout candidate under this rule, not proof of lasting continuation. A close inside is a sweep pattern, not proof of reversal. A liquidity void usually describes an area crossed rapidly with limited price overlap; this detector does not calculate voids, fair value gaps, order-book depth, or actual stop orders.

No universal relative-volume threshold separates a sweep from a breakout. If you add volume, session, or trend filters, define them before evaluating a sample and inspect failures as well as successes.

Check the time a signal became available

With Right Bars set to 2, a pivot at bar 10 becomes known at the close of bar 12. If bar 13 sweeps it, the Pine example marks bar 13 at its close. With browser Confirm Bars set to 1, that result is available only after bar 14 also closes inside the level. The results list separates the sweep bar from the confirmation bar.

The script uses the chart timeframe and does not request future or higher-timeframe data. It marks sweeps on their detection bar without a backward offset. TradingView documents why backdated pivot plots and changing realtime prices can make historical charts misleading. Waiting for the close reduces intrabar uncertainty, but data revisions and changes to loaded history can still change recalculations.

A forward-check procedure, not a reported live test

  1. Record the symbol, exchange feed, standard candle timeframe, inputs, and script version. Start with Confirm Bars = 0 when comparing this browser tool with Pine.
  2. On an open market, record when a pivot first appears and when the next breach closes. Save both bar timestamps and the alert log; an intrabar wick alone must not produce a confirmed marker.
  3. After more bars close, reload the chart and compare the same timestamps. Investigate moved or missing markers before relying on historical charts.
  4. Test a breach that closes outside, a close exactly on the level, two pivots with the same price, and a sample ending before the extra confirmation bars. The first breach consumes the level; a later distinct pivot may reuse that price.

Bar Replay can help inspect sequencing, but it does not reproduce every realtime update or establish live alert delivery. No live forward-test or profitability result is claimed here.

Pine Script v6: confirmed pivots and sweep alerts

This educational indicator uses the same strict pivot and first-breach rules as the browser tool with Confirm Bars = 0. It tracks one active level per side, excludes equal highs/lows in each pivot window, and waits for barstate.isconfirmed before changing state or marking a sweep. It is not a strategy and has no entries, exits, or performance results.

//@version=6
indicator("Confirmed Liquidity Sweeps [Pineify]", overlay = true)

int leftBars = input.int(2, "Left bars", minval = 1, maxval = 10)
int rightBars = input.int(2, "Right bars", minval = 1, maxval = 10)
bool alertsEnabled = input.bool(true, "Enable alert calls")

// Strict pivots: equal highs/lows are excluded, matching the browser tool.
float leftHigh = ta.highest(high, leftBars)[rightBars + 1]
float rightHigh = ta.highest(high, rightBars)
float leftLow = ta.lowest(low, leftBars)[rightBars + 1]
float rightLow = ta.lowest(low, rightBars)
bool enoughBars = bar_index >= leftBars + rightBars
bool pivotHigh = enoughBars and high[rightBars] > leftHigh and high[rightBars] > rightHigh
bool pivotLow = enoughBars and low[rightBars] < leftLow and low[rightBars] < rightLow

var float activeHigh = na
var float activeLow = na
bool sweepHigh = false
bool sweepLow = false

if barstate.isconfirmed
    // A new confirmed pivot replaces the previous level on that side.
    if pivotHigh
        activeHigh := high[rightBars]
    if pivotLow
        activeLow := low[rightBars]

    // The first strict breach consumes the level, whether sweep or breakout.
    if not na(activeHigh) and high > activeHigh
        sweepHigh := close < activeHigh
        activeHigh := na
    if not na(activeLow) and low < activeLow
        sweepLow := close > activeLow
        activeLow := na

plot(activeHigh, "Active high", color = color.orange, style = plot.style_linebr)
plot(activeLow, "Active low", color = color.teal, style = plot.style_linebr)
plotshape(sweepHigh, title = "High sweep", style = shape.triangledown, location = location.abovebar, color = color.orange, text = "High sweep")
plotshape(sweepLow, title = "Low sweep", style = shape.triangleup, location = location.belowbar, color = color.teal, text = "Low sweep")

if alertsEnabled and (sweepHigh or sweepLow)
    string side = sweepHigh and sweepLow ? "Both sides" : sweepHigh ? "High" : "Low"
    alert(side + " sweep on " + syminfo.tickerid + " at close " + str.tostring(close, format.mintick), alert.freq_once_per_bar_close)

Install and create an alert

  1. Open TradingView's Pine Editor, create an indicator, paste the complete code, then save and add it to a standard candlestick chart.
  2. Choose Left Bars and Right Bars. Larger windows require a swing to exceed more neighboring bars; more Right Bars also means a longer confirmation delay. The default is an example, not an optimized setting.
  3. Create an alert, select this indicator and "Any alert() function call". The script sets once-per-bar-close frequency. If one candle sweeps both sides, it sends one combined message.
  4. After changing inputs, symbol, timeframe or code, recreate the alert to use the revised configuration. See TradingView's alert documentation. A webhook requires separate alert configuration and a receiving service; the script does not execute broker orders.

Liquidity sweep indicator FAQs

What is the best liquidity sweep indicator for TradingView?

Choose one whose pivot delay, reclaim rule, level expiry and alert timing match your workflow. A screenshot or signal count cannot establish which indicator performs best. This page provides a free, inspectable baseline and a checklist for comparing alternatives; it does not rank trading performance.

Does a liquidity sweep prove that institutions hunted stops?

No. This detector sees OHLC prices, not resting orders or participant identities. Buy-side and sell-side liquidity are labels for reference levels above highs and below lows; a sweep here means a strict breach followed by a close back across the level.

When is a pivot available, and can the signal repaint?

A pivot becomes available only after all Right Bars have closed. This script updates levels and emits sweep markers at bar close, with no backward marker offset. Revised market data or a different history window can still change recalculated results. No live forward-test result is claimed.

Why can the browser tool and Pine Script show different counts?

The browser accepts only completed OHLC bars and optionally waits for extra confirmation bars. Set Confirm Bars to 0 and use identical data and Left/Right inputs to compare with the Pine example. Both exclude equal-price pivots and consume a level after its first strict breach.

Is the detector free, and does it place trades?

The browser detector and example code are free to use. Neither places trades or connects to a broker. TradingView alerts must be created separately; Pineify AI customization is a separate product with its own access terms.

Customize the sweep rules with Pineify

Use Pine Script AI Coding Agent to request session filters, a different reclaim window, or custom alert messages. Specify the confirmation delay and level-expiry rule in your request, then review the generated code and test its behavior on TradingView.

For education and analysis only, not investment advice. A sweep marker is a price-pattern observation, not a trade recommendation or a guarantee of reversal. Trading can result in loss.