//@version=5 indicator("McClellan Summation Index") var previousIndexValue = float(na) advances = request.security("ADVN", "D", close) declines = request.security("DECN", "D", close) oscillatorValue = ta.ema(advances - declines, 19) - ta.ema(advances - declines, 39) indexValue = nz(previousIndexValue) + oscillatorValue previousIndexValue := indexValue plot(indexValue)