I am trying to do a SMA on a CCI with the periods used as an input. This code is being kicked out with a CS0021, Cannot apply indexing with [] to an expression of type 'method group' for line 46.
I have looked the error message up but it doesn't seem to help with line 46: for (int barsAgo = 0; barsAgo < Period; barsAgo++)
also i put brackets after CCI(0) - should there be a number instead of 0 - what is it? where do i find it from?
sum = sum + CCI(0)[barsAgo];
thanks
protectedoverridevoid OnBarUpdate()
{
if (CurrentBar < Period) return;
double sum = 0;
for (int barsAgo = 0; barsAgo < Period; barsAgo++)
{
sum = sum + CCI(0)[barsAgo];
}
Plot0.Set(sum/Period);
}
Comment