diff --git a/nyse_cumulative_new_highs_new_lows.pine b/nyse_cumulative_new_highs_new_lows.pine new file mode 100644 index 0000000..ed19b0e --- /dev/null +++ b/nyse_cumulative_new_highs_new_lows.pine @@ -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)) \ No newline at end of file