// Input Parameters src = input(defval=close, title="Source") per = input.int(defval=100, minval=1, title="Sampling Period") mult = input.float(defval=3.0, minval=0.1, title="Range Multiplier")
// Smooth Range Function smoothrng(x, t, m) => wper = t * 2 - 1 avrng = ta.ema(math.abs(x - x[1]), t) smoothVal = ta.ema(avrng, wper) * m smoothVal
// Compute Smooth Range smrng = smoothrng(src, per, mult)
// Range Filter Function rngfilt(x, r) => filtVal = x filtVal := x > nz(filtVal[1]) ? (x - r < nz(filtVal[1]) ? nz(filtVal[1]) : x - r) : (x + r > nz(filtVal[1]) ? nz(filtVal[1]) : x + r) filtVal
// Fill the areas between the bands and filter line fill1 = plot(hband, color=color.new(color.aqua, 90), title="High Target") fill2 = plot(filt, color=color.new(color.aqua, 90), title="Range Filter") fill(fill1, fill2, color=color.new(color.aqua, 90), title="High Target Range")