I'm trying to code a Fibonacci Bollinger indicator. I'm getting an "index outside the bounds of the array" error in the log. I do not know what this means exactly, so I'm at a bit of a loss to correct it...the code is a modification of the Bollinger Bands code:
privatedouble numStdDev = 2;
privateint period = 14;
double factor1 = 1.618;
protectedoverridevoid Initialize()
{
Add(new Plot(Color.Cyan, "Upper band"));
Add(new Plot(Color.Green, "Middle band"));
Add(new Plot(Color.Orange, "Lower band"));
}
protectedoverridevoid OnBarUpdate()
{
Upper.Set(SMA(Close, Period)[0] + NumStdDev * (factor1 * ATR(Period)[0]));
Middle.Set(SMA(Close, Period)[0]);
Lower.Set(SMA(Close, Period)[0] - NumStdDev * (factor1 * ATR(Period)[0]));
}
Any clues on the cause and/or meaning of the error?

Comment