From fb60515e1fc7fad5fa0c5ddaee7df921c6f91064 Mon Sep 17 00:00:00 2001 From: moshferatu Date: Wed, 3 Jul 2024 12:16:40 -0700 Subject: [PATCH] Add NYSE Cumulative 52 Week New highs New Lows breadth indicator --- nyse_cumulative_new_highs_new_lows.pine | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 nyse_cumulative_new_highs_new_lows.pine 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