// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © goodgains
//@version=5
indicator("Litt Volume ++")
// @keywords: relative-volume, rvol-histogram, rvol-ema-average, volume-threshold-bands, high-low-volume-zones, volume-columns-plot, smoothed-volume-baseline, extreme-volume-marker, average-rvol-area, dashed-threshold-line, volume-compare-period, intraday-volume-spike, below-average-volume, volume-ema-smoothing, rvol-ratio-plot, volume-intensity-scale, percent-volume-baseline, volume-momentum, liquidity-gauge, volume-regime
//VOLUME
above_threshold1_color = input.color(color.new(#4dd0e1,30), title = "Extremly High Volume",group='Volume Settings')
above_threshold2_color = input.color(color.new(color.yellow,30), title = "High Volume",group='Volume Settings')
normal_color = input.color(color.new(color.white,30), title = "Normal Volume",group='Volume Settings')
below_threshold1_color = input.color(color.new(color.gray,50), title = "Low Volume",group='Volume Settings')
period = 100
vol = volume
svol = ta.ema(vol, period)
rvol = vol / svol[1]
avg_rvol = ta.ema(rvol,20)
rvol_upthreshold1 = 2.00
rvol_upthreshold2 = 1.25
rvol_downthreshold1 = 0.80
rvol_downthreshold2 = 0.30
//rvol_color = rvol >= rvol_upthreshold1 ? above_threshold1_color : rvol >= rvol_upthreshold2 ? above_threshold2_color : rvol <= rvol_downthreshold2 ? below_threshold2_color : rvol <= rvol_downthreshold1 ? below_threshold1_color : normal_color
rvol_color =avg_rvol >= rvol_upthreshold1 ? above_threshold1_color: avg_rvol >= rvol_upthreshold2 ? above_threshold2_color : avg_rvol <= rvol_downthreshold1 ? below_threshold1_color : normal_color
plot(rvol, style = plot.style_columns, editable = false , color = rvol_color)
plot(avg_rvol, style = plot.style_area, editable = false , color = color.new(normal_color,95))
threshold_line = hline(rvol_upthreshold1, linestyle=hline.style_dashed, editable = false, color = below_threshold1_color)