Volume
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © rvtradesetup

//@version=5
indicator("Volume", format = format.volume)
len     = input(20, "Length", group = "MA")
tf      = timeframe.period
ticker  = syminfo.tickerid

s       = ticker == "NSE:NIFTY" ? "NSE:NIFTY1!" : ticker == "NSE:BANKNIFTY" ? "NSE:BANKNIFTY1!" : ticker == "NSE:CNXFINANCE" ? "NSE:FINNIFTY1!" : ticker
vol     = request.security(s, tf, volume)
colr    = (close > open) ? color.new(#22ab94, 40) : color.new(#f7525f, 40)
ma      = ta.sma(vol, len)

plot(vol, title = "Volume" , color = colr, style = plot.style_columns)
plot(ma, title = "MA", color = color.orange)