//@version=6 indicator("IMG 31 — Daily Volume Context", overlay=false) // Daily comparison only; this is NOT time-of-day normalized intraday volume. if not timeframe.isdaily or timeframe.multiplier != 1 runtime.error("Use a one-day chart.") float baseline = ta.sma(volume[1], 20) // SMA skips na values; explicitly require 20 consecutive valid prior bars. bool completeWindow = ta.sma(na(volume[1]) ? 0.0 : 1.0, 20) == 1.0 float ratio = barstate.isconfirmed and completeWindow and not na(volume) and baseline > 0 ? volume / baseline : na float locationFraction = barstate.isconfirmed and high > low ? (close-low)/(high-low) : na plot(ratio, "Volume / prior 20 daily bars", color=color.black, style=plot.style_columns) hline(1, "Baseline", color=color.gray) plot(locationFraction, "Close location 0 to 1", display=display.data_window) plot(completeWindow ? baseline : na, "Prior 20-bar volume mean", display=display.data_window)