Make the RSI value array length dyanmic according to the number of time frames being monitored

This commit is contained in:
moshferatu 2023-11-12 07:18:54 -08:00
parent f35b0bac63
commit dec652e906

View File

@ -24,8 +24,8 @@ namespace NinjaTrader.NinjaScript.Indicators
private Dictionary<string, RSI> RSIIndicators = new Dictionary<string, RSI>();
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;