Why when I tried the below code, it only give me the highs from 2883?

for(int i=0;i<3000;i++)

{
Print(High[i] );
Print (i);
}

thanks for your help

how long is your history data?

the Bars 11968

Sorry I’m a little slow sometimes… MQL4 right? Are you trying to echo the highs of the last 3000 periods?

Not at all, yes that’s what I am trying to do

Thanks

Try this instead maybe?

Print(iHigh(NULL,PERIOD_CURRENT,i));

I don’t have an available machine to test on right now, but I can whip one up in a while if need be.

TYT, for some reason it still displays from candle 2885 onwards till 2999, although I am starting the loop from 0

What does the

Print(i);

output?

That should be looping through the index position starting at 0 regardless of market data. Does that also start at 2885? Is it always 2885, or is it sometimes a different number?

I would normally declare the position variable outside of the loop:

int count;
for(count=0;count<3000;count++)
{
Do Stuff;
}

That shouldn’t make a difference though afaik. I am curious if it’s some weird memory reference thing.