Indicator · Pine Script v6 · Own pane

Toxic Flow Radar

by omm9846

A volume-based order flow gauge in a separate pane.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code59
Settings7inputs
LicenceMIT
Last update4 months ago28 Jun 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

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

toxic_flow_radar.pine
//@version=6
// Toxic Flow Radar [EnsoTrade] - directional order-flow + VPIN toxicity gauge.
// Built by EnsoTrade (ensotrade.tech) - live crypto order-flow terminal.
indicator("Toxic Flow Radar [EnsoTrade]", shorttitle="Toxic Flow", overlay=false, precision=2)

// --- Inputs ---
len     = input.int(14, "Flow window (bars)", minval=2, group="Engine")
smooth  = input.int(3,  "Smoothing", minval=1, group="Engine")
warnLvl = input.float(0.40, "Elevated level", step=0.01, group="Levels")
toxLvl  = input.float(0.55, "Toxic level", step=0.01, group="Levels")
showBg  = input.bool(true, "Shade background on toxic flow", group="Display")
showABS = input.bool(true, "Show absorption marks", group="Display")
showHUD = input.bool(true, "Show status panel", group="Display")

// --- Order-flow delta proxy (needs only volume) ---
rng     = math.max(high - low, syminfo.mintick)
buyVol  = volume * (close - low) / rng
sellVol = volume * (high - close) / rng
delta   = buyVol - sellVol

// --- Toxicity (height): |imbalance| / total volume, 0..1 ---
imb     = math.sum(math.abs(delta), len)
tot     = math.sum(volume, len)
vpin    = ta.ema(tot > 0 ? imb / tot : 0.0, smooth)

// --- Direction (color): net pressure, who is winning NOW ---
press   = tot > 0 ? math.sum(delta, len) / tot : 0.0
pressSm = ta.ema(press, smooth)
buyers  = pressSm >= 0

// --- State ---
isTox  = vpin >= toxLvl
isWarn = vpin >= warnLvl and not isTox

// --- Color: green=buyers / red=sellers ; bright=toxic, dim=calm ---
transp = isTox ? 0 : isWarn ? 25 : 60
col    = color.new(buyers ? #00e676 : #ff1744, transp)

plot(vpin, "Toxic Flow", color=col, style=plot.style_columns)
hline(toxLvl,  "Toxic",    color=color.new(color.red, 0),    linestyle=hline.style_dashed)
hline(warnLvl, "Elevated", color=color.new(color.orange, 0), linestyle=hline.style_dotted)
bgcolor(showBg and isTox ? color.new(buyers ? color.green : color.red, 90) : na)

// --- Absorption: heavy toxic flow but price stalls = quiet accumulation/distribution ---
priceMove  = math.abs(close - close[len]) / close[len]
absorption = isTox and priceMove < 0.005
plotshape(showABS and absorption, "Absorption", style=shape.diamond, location=location.top, color=color.new(color.yellow, 0), size=size.tiny)

// --- Alerts ---
alertcondition(ta.crossover(vpin, toxLvl), "Toxic flow", "Toxic order flow detected - informed traders active")
alertcondition(absorption, "Absorption", "Absorption: toxic flow with stalling price")

// --- Status panel ---
stateTxt = isTox ? (buyers ? "TOXIC up - buyers" : "TOXIC down - sellers") : isWarn ? (buyers ? "ELEVATED up" : "ELEVATED down") : "CALM"
stateCol = isTox ? (buyers ? color.new(#00e676, 0) : color.new(#ff1744, 0)) : isWarn ? color.new(#ff9100, 0) : color.new(color.gray, 0)
var table hud = table.new(position.top_right, 1, 2, border_width=1)
if showHUD and barstate.islast
    table.cell(hud, 0, 0, stateTxt + "   " + str.tostring(vpin, "0.00"), text_color=color.white, bgcolor=stateCol, text_size=size.normal)
    table.cell(hud, 0, 1, "Toxic Flow Radar - EnsoTrade", text_color=color.new(color.white, 15), bgcolor=color.new(color.black, 20), text_size=size.small)

Overview

Toxic Flow Radar estimates buying and selling volume from each candle's close position within its range, then measures how one-sided that flow has been over a rolling window, in the style of VPIN. Columns turn green or red by net pressure and brighten above elevated and toxic levels. It marks absorption when flow is heavy but price barely moves, shades the background, shows a status panel and offers alerts. It needs a symbol that reports volume and is only an approximation of real order flow.

Details

Published by

omm9846 on GitHub

Type

Indicator, Pine Script v6

Draws

Separate pane below the chart

Category

Volume, Oscillators & momentum

Markets

Crypto

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.

Settings

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

SettingTypeDefaultVariable
Flow window (bars)int14len
Smoothingint3smooth
Elevated levelfloat0.40warnLvl
Toxic levelfloat0.55toxLvl
Shade background on toxic flowbooltrueshowBg
Show absorption marksbooltrueshowABS
Show status panelbooltrueshowHUD
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

Money Flow Index

by everget
948 stars

Calculates the standard Money Flow Index (MFI) oscillator alongside an exponential moving average signal line in a separate pane. The script visually highlights trend conditions through dynamic ribbon filling, optional difference histogram bars, and overbought

Indicator v4 Oscillators & momentumVolume
Updated 11 days ago · GPL-3.0 GitHub repository of Money Flow Index

Commitment Gauge

by harryguiacorn
219 stars

This indicator measures directional momentum by evaluating candlestick body proportions and volume over a user-defined lookback window. It computes the ratio of candle body to total range, weights the cumulative value by volume and absolute body size, and dete

Indicator v4 VolumeCandlestick patterns
Updated 1 year ago · None stated GitHub repository of Commitment Gauge

Aggregate Signal

by capissimo
114 stars

This indicator builds an aggregate oscillator in a separate pane. It scales open, high, low, close, and volume into a 0 to 1 range, then averages scaled readings from MACD, a MACD histogram, RSI, stochastic, CCI, momentum, OBV, a directional index, volume-weig

Indicator v4 Oscillators & momentumVolume Repaints
Updated 1 year ago · None stated GitHub repository of Aggregate Signal

This indicator calculates the Bill Williams Market Facilitation Index as the high-low range divided by volume, or zero when volume is zero. It compares the index and volume with the previous bar and assigns one of four zones: green for both rising, fade for bo

Indicator v6 VolumeOscillators & momentum
Updated 4 weeks ago · Apache-2.0 GitHub repository of Bill Williams Market Facilitation Index

PPO ATR Bands

by cryptorife
75 stars

PPO ATR Bands plots a percentage price oscillator in a separate pane. It compares a Hull average of typical price with a volume-weighted exponential average of Parabolic SAR, then scales three true-range bands around the slow average into matching oscillator l

Indicator v4 Oscillators & momentumMoving averages
Updated 3 years ago · GPL-3.0 GitHub repository of PPO ATR Bands

Chaikin Oscillator

by be-thomas
65 stars

Calculates the Chaikin Oscillator by taking the difference between a fast exponential moving average and a slow exponential moving average of the Accumulation/Distribution line. It plots the resulting line in a separate pane alongside a dashed zero reference l

Indicator v4 Oscillators & momentumVolume
Updated 5 days ago · GPL-3.0 GitHub repository of Chaikin Oscillator

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