repaint = input(true, 'Repainting Smoothing', tooltip = 'Repainting is an effect where the indicators historical output is subject to change over time. Disabling repainting will cause the indicator to output the endpoints of the calculations')
//-----------------------------------------------------------------------------} //Append lines //-----------------------------------------------------------------------------{ n = bar_index
var ln = array.new_line(0)
if barstate.isfirst and repaint for i = 0 to 499 array.push(ln,line.new(na,na,na,na))
//-----------------------------------------------------------------------------} //End point method //-----------------------------------------------------------------------------{ var coefs = array.new_float(0) var den = 0.
if barstate.isfirst and not repaint for i = 0 to 499 w = gauss(i, h) coefs.push(w)
den := coefs.sum()
out = 0. if not repaint for i = 0 to 499 out += src * coefs.get(i) out /= den mae = ta.sma(math.abs(src - out), 499) * mult
upper = out + mae lower = out - mae
//-----------------------------------------------------------------------------} //Compute and display NWE //-----------------------------------------------------------------------------{ float y2 = na float y1 = na
nwe = array.new<float>(0) if barstate.islast and repaint sae = 0. //Compute and set NWE point for i = 0 to math.min(499,n - 1) sum = 0. sumw = 0. //Compute weighted mean for j = 0 to math.min(499,n - 1) w = gauss(i - j, h) sum += src[j] * w sumw += w