tradingview/mcclellan_summation_index.pine

13 lines
374 B
Plaintext
Raw Normal View History

//@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)