Indicator · Pine Script v6 · On the chart

Liquidation Reversal Signals [AlgoAlpha]

by theonetrade· code credited to AlgoAlpha

The indicator identifies potential market reversal points following significant volume spikes.

View on GitHub

GitHub stars34on the repository
Pine versionv6current
Lines of code112
Settings6inputs
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

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

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

//@version=6
indicator("Liquidation Reversal Signals [AlgoAlpha]", "AlgoAlpha - Liquidation Reversal", true, max_lines_count = 500, behind_chart = false)
import TradingView/ta/10 as tvta

// ========================= Inputs =========================
// Data
lowerTF = input.timeframe("15", title = "Lower Timeframe", group = "Data", tooltip = "Lower timeframe used by the up/down volume request.")

// Z-Score
length = input.int(200, "Z Score Length", minval = 1, group = "Z-Score", tooltip = "Lookback length for mean and standard deviation when computing z-scores of up/down volume.")
zThresh = input.float(3.0, "Z-Score Threshold", minval = 0.0, step = 0.1, group = "Z-Score", tooltip = "Minimum z-score required to register a liquidation spike.")

// Detection
timeoutBars = input.int(50, "Liquidation Timeout Bars (0 = none)", minval = 0, group = "Detection", tooltip = "Maximum bars between a qualifying liquidation and the Supertrend flip. Set 0 to disable the timeout.")

// Appearance
green = input.color(#00ffbb, title = "Bullish Colour", group = "Appearance", tooltip = "Color used for bullish visuals and positive sentiment texts.")
red   = input.color(#ff1100, title = "Bearish Colour", group = "Appearance", tooltip = "Color used for bearish visuals and negative sentiment texts.")

// ========================= Calculations =========================
[u, d, _] = tvta.requestUpAndDownVolume(lowerTF)
d := -d

meanU = ta.sma(u, length)
stdevU = ta.stdev(u, length)
zU = stdevU != 0 ? (u - meanU) / stdevU : na

meanD = ta.sma(d, length)
stdevD = ta.stdev(d, length)
zD = stdevD != 0 ? (d - meanD) / stdevD : na

[supertrend, direction] = ta.supertrend(2, 10)
shortLiq = (direction < 0) and (zU > zThresh)
longLiq = (direction > 0) and (zD > zThresh)

var lastliqdir = 0
var lastliqindex = 0
var valid = 0

var plottrnd = 0
if ta.cross(direction, 0)
    plottrnd := 0
if ta.crossunder(direction, 0) and lastliqdir == 1 and valid == 1
    if bar_index - lastliqindex < timeoutBars
        plottrnd := 1
    valid := 0
if ta.crossover(direction, 0) and lastliqdir == -1 and valid == 1
    if bar_index - lastliqindex < timeoutBars
        plottrnd := -1
    valid := 0

if shortLiq
    lastliqdir := -1
    lastliqindex := bar_index
    valid := 1
if longLiq
    lastliqdir := 1
    lastliqindex := bar_index
    valid := 1

x = 7
lw = ta.lowest(x)
hg = ta.highest(x)
newBullSt = plottrnd == -1 and plottrnd[1] != -1
newBearSt = plottrnd == 1 and plottrnd[1] != 1

vola = ta.atr(14)
zMagShort = math.abs(zU)
zMagLong = math.abs(zD)

normShort = math.min(math.max((zMagShort - zThresh) / 5, 0), 1)
normLong = math.min(math.max((zMagLong - zThresh) / 5, 0), 1)
transpMax = 70
transpMin = 30
transpShort = math.round(transpMax - normShort * (transpMax - transpMin))
transpLong = math.round(transpMax - normLong * (transpMax - transpMin))
colShort = color.new(green, transpShort)
colLong = color.new(red, transpLong)
candleCol = plottrnd == -1 ? color.from_gradient(50, 0, 100, red, chart.bg_color) : plottrnd == 1 ? color.from_gradient(50, 0, 100, green, chart.bg_color) : color.new(green, 100)
// ========================= Visuals =========================
// Hidden midpoint between candle body
midBody = math.avg(open, close)
midPlot = plot(midBody, title = "Mid Body", display = display.none)

stBull = plot(plottrnd == -1 ? supertrend : na, "Bullish Trend", red, style = plot.style_linebr)
stBear = plot(plottrnd == 1 ? supertrend : na, "Bearish Trend", green, style = plot.style_linebr)

fill(midPlot, stBull, color.new(red, 90), title = "Bullish Fill")
fill(midPlot, stBear, color.new(green, 90), title = "Bearish Fill")
plotshape(newBullSt, "Bullish ST Start", shape.labeldown, location.abovebar, color.new(red, 30), text = "▼", textcolor = chart.fg_color, size = size.tiny)
plotshape(newBearSt, "Bearish ST Start", shape.labelup, location.belowbar, color.new(green, 30), text = "▲", textcolor = chart.fg_color, size = size.tiny)
plotchar(shortLiq ? high+vola : na, "Short Liquidation", "●", location.absolute, colShort, size = size.tiny)
plotchar(longLiq ? low-vola : na, "Long Liquidation", "●", location.absolute, colLong, size = size.tiny)
plotcandle(open, high, low, close, "Candles", candleCol, candleCol, bordercolor = candleCol)

// ========================= Alerts =========================
alertcondition(newBullSt, title = "Bullish ST Start", message = "Bullish supertrend became visible after qualifying liquidation and confirmation.")
alertcondition(newBearSt, title = "Bearish ST Start", message = "Bearish supertrend became visible after qualifying liquidation and confirmation.")
alertcondition(shortLiq, title = "Short Liquidation Spike", message = "Short-side liquidation detected (zU > threshold).")
alertcondition(longLiq, title = "Long Liquidation Spike", message = "Long-side liquidation detected (zD > threshold).")

// ========================= Table Warning =========================
var table warnTbl = table.new(position.middle_right, 1, 1)
noVol = na(volume) or volume == 0 or (na(u) and na(d))
table.cell(warnTbl, 0, 0,
     noVol ? "No Volume" : "",
     text_color = noVol ? color.white : color.new(chart.fg_color, 100),
     bgcolor = noVol ? color.new(red, 0) : color.new(chart.bg_color, 100)
 )

Overview

Liquidation Reversal Signals [AlgoAlpha] uses lower-timeframe volume data to calculate Z-scores for up and down volume against a rolling moving average and standard deviation. When volume Z-scores exceed a specified threshold during active trends, it flags potential liquidation events. If a Supertrend indicator flips direction within a defined timeout window after a liquidation spike, the script plots reversal signals directly on the price chart. Users can customize the lower timeframe, Z-score lookback period, threshold value, and timeout duration.

Details

Published by

theonetrade on GitHub

Code credit

AlgoAlpha, as written in the script's header

Draws

On the price chart

Markets

Crypto

Timeframes

M15-H1

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
Lower Timeframetimeframe15lowerTF
Z Score Lengthint200length
Z-Score Thresholdfloat3.0zThresh
Liquidation Timeout Bars (0 = none)int50timeoutBars
Bullish Colourcolor#00ffbbgreen
Bearish Colourcolor#ff1100red
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

Linear Regression Volume

by vedkanani123
1 stars

An overlay indicator that computes a volume-weighted price average using SMA, RMA, HMA or ALMA, fits a linear regression to it as a fair value baseline, and draws bands at one, two and three standard deviations of price around it. The baseline and band fills t

Indicator v6 TrendVolume
Updated 3 months ago · None stated GitHub repository of Linear Regression Volume

The Momentum Setup is a multi-indicator visual tool designed for trend and momentum analysis directly on the price chart. It combines Relative Strength Index (RSI), Money Flow Index (MFI), Commodity Channel Index (CCI), Supertrend, and a 250-bar percentage cha

Indicator v5 Oscillators & momentumTrend
Updated 1 year ago · MPL-2.0 GitHub repository of Momentum Setup - Ankush Bajaj Momentum Investing Setup
257 stars

This indicator plots auto trade signals for E-mini S&P 500 futures on the price chart. It computes an EMA200 filter along with day ETH RTH session levels and percentage-based entry zones. Signals trigger CALL or PUT cases when price crosses defined thresholds

Indicator v6 TrendSupport & resistance
Updated 2 months ago · None stated GitHub repository of Auto Trade Futures ES

Adaptive MA Slope

by capissimo
114 stars

This indicator calculates Kaufman's Adaptive Moving Average (KAMA) on a chosen price source and determines trend direction based on the slope across a configurable lookback window. Signals can be filtered by short-term volatility expansion using ATR comparison

Indicator v4 Moving averagesTrend
Updated 2 years ago · None stated GitHub repository of Adaptive MA Slope
98 stars

This indicator plots a volume-weighted average price of the typical price on the chart and colors that line by ADX strength. It draws a standard-deviation envelope around VWAP and tints the fill green when plus DI leads and red when minus DI leads. Triangle ma

Indicator v5 TrendOscillators & momentum
Updated 2 months ago · Custom licence GitHub repository of Moon Dev VWAP x ADX Explosion

Signal Strategy 15m

by tripolskypetr
72 stars

This indicator generates trend-following trade signals on the price chart by combining moving average crossovers with multi-factor filters. It triggers entry alerts when fast and slow EMAs cross in the direction of a baseline trend EMA, confirmed by non-extrem

Indicator v5 TrendMoving averages
Updated 4 weeks ago · MIT GitHub repository of Signal Strategy 15m

More Volume 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