the code below gives an out of range error while I dont think it should.
I just want to access value of an array after the selected bar, to plot a
forecast.
I tried with or without var required and I always get the same error, even if
start<barcount( at least from what I can read in the interpretation window).
But if I trace it I get that start=barcount,which explain the error.
How can it be?
SetBarsRequired( -2, -2);
bi=BarIndex();
Plot(C,"C",colorBlue);
start=SelectedValue(bi)-bi[0];
printf("\n selected bi="+SelectedValue(bi));
printf("\n bi[0]="+bi[0]);
printf("\n start=selected bi-bi[0]="+start);
printf("\n barcount"+BarCount);
printf("\n start+1="+(start+1));
printf("\n c[start]="+C[start]);
_TRACE("\n selected bi="+SelectedValue(bi));
_TRACE("\n bi[0]="+bi[0]);
_TRACE("\n start=selected bi-bi[0]="+start);
_TRACE("\n barcount"+BarCount);
_TRACE("\n start+1="+(start+1));
_TRACE("\n c[start]="+C[start]);
_TRACE("\n c[start+1]="+C[start+1]);
_TRACE("\n c[start+1]="+C[start+1]);
printf("\n c[start+1]="+C[start+1]);
Regards
Ly