From 46fe64f59cbd32b28d7f0a2c5d3679e7d8027904 Mon Sep 17 00:00:00 2001 From: moshferatu Date: Wed, 3 Jul 2024 12:18:55 -0700 Subject: [PATCH] Add NASDAQ Cumulative New Highs New Lows breadth indicator --- nasdaq_cumulative_new_highs_new_lows.pine | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 nasdaq_cumulative_new_highs_new_lows.pine diff --git a/nasdaq_cumulative_new_highs_new_lows.pine b/nasdaq_cumulative_new_highs_new_lows.pine new file mode 100644 index 0000000..2945314 --- /dev/null +++ b/nasdaq_cumulative_new_highs_new_lows.pine @@ -0,0 +1,18 @@ +//@version = 5 +indicator("NASDAQ Cumulative New Highs New Lows", overlay = true) + +var cumulativeNewHighsLows = float(na) + +newHighs = request.security("HIGQ", "D", close) +newLows = request.security("LOWQ", "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