OPEN-SOURCE SCRIPT

Unusual Volume

15
//version=5
indicator("Unusual Volume", overlay=false)

// --- Inputs ---
len = input.int(20, "Average Volume Length", minval=1)
mult = input.float(2.0, "Unusual Volume Multiplier", step=0.1)

// --- Calculations ---
avgVol = ta.sma(volume, len)
ratio = volume / avgVol
isBigVol = ratio > mult

// --- Plots ---
plot(volume, "Volume", style=plot.style_columns,
color = isBigVol ? color.new(color.green, 0) : color.new(color.gray, 60))

plot(avgVol, "Average Volume", color=color.orange)

// Mark unusual volume bars
plotshape(isBigVol, title="Unusual Volume Marker",
location=location.bottom, style=shape.triangleup,
color=color.green, size=size.tiny, text="UV")

// Optional: show ratio in Data Window
var label ratioLabel = na

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.