int Lookback = 10
double minvalue = MIN(Low, Lookback)[1];
but this throws an error
System.ArgumentOutOfRangeException
HResult=0x80131502
Message=Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Source=mscorlib
StackTrace:
at System.ThrowHelper.ThrowArgumentOutOfRangeExceptio n(ExceptionArgument argument, ExceptionResource resource)
at NinjaTrader.NinjaScript.Series`1.get_Item(Int32 barsAgo)
at NinjaTrader.NinjaScript.NinjaScriptBase.get_Item(I nt32 barsAgo)
...
at NinjaTrader.NinjaScript.NinjaScriptBase.Update(Int 32 idx, Int32 bip)
I checked and only Low[0] and Low[1] exist, Low[2] hasnt been formed when this error occurs.
But Low.Count is 1040 (although in the Watch Window, under Low, Count actually says zero)
How can I check myself if the data has enough values to use this method?
Comment