Add NYSE Cumulative 52 Week New highs New Lows breadth indicator

This commit is contained in:
moshferatu 2024-07-03 12:16:40 -07:00
parent b57fe240e7
commit fb60515e1f

View File

@ -0,0 +1,18 @@
//@version = 5
indicator("NYSE Cumulative New Highs New Lows", overlay = false)
var cumulativeNewHighsLows = float(na)
newHighs = request.security("HIGN", "D", close)
newLows = request.security("LOWN", "D", close)
newHighsLows = nz(cumulativeNewHighsLows) + (newHighs - newLows)
cumulativeNewHighsLows := newHighsLows
mean = ta.sma(cumulativeNewHighsLows, 252)
stdev = ta.stdev(cumulativeNewHighsLows, 252)
zScore = (cumulativeNewHighsLows - mean) / stdev
plot(zScore)
regimeColor = zScore > 0 ? color.green : color.red
bgcolor(color.new(regimeColor, transp = 75))