From dec652e906658ef3345765e163aba762227f1a58 Mon Sep 17 00:00:00 2001 From: moshferatu Date: Sun, 12 Nov 2023 07:18:54 -0800 Subject: [PATCH] Make the RSI value array length dyanmic according to the number of time frames being monitored --- indicators/RSIDashboard.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/indicators/RSIDashboard.cs b/indicators/RSIDashboard.cs index cfea99d..6179e34 100644 --- a/indicators/RSIDashboard.cs +++ b/indicators/RSIDashboard.cs @@ -24,8 +24,8 @@ namespace NinjaTrader.NinjaScript.Indicators private Dictionary RSIIndicators = new Dictionary(); - private string[] TimeFrames = new[] { "1 Minute", "5 Minutes", "30 Minutes", "1 Hour", "4 Hours", "Daily", "Weekly" }; - private double[] RSIValues = new double[7]; + private string[] TimeFrames; + private double[] RSIValues; protected override void OnStateChange() { @@ -35,6 +35,8 @@ namespace NinjaTrader.NinjaScript.Indicators Name = "RSI Dashboard"; Calculate = Calculate.OnBarClose; IsOverlay = true; + TimeFrames = new[] { "1 Minute", "5 Minutes", "30 Minutes", "1 Hour", "4 Hours", "Daily", "Weekly" }; + RSIValues = new double[TimeFrames.Length]; RSIPeriod = 14; RSISmoothing = 3; UpperThreshold = 65;