Bug found?

 

I have been 3 hours with this... trying to find an error on my code, but it seems is not the logic, anyone can explain it?


     int i=0;   
     int j=1;
     while(i<300)
      {
      Alert("i= ",i," ", iTime(Symbol(),j,i));
      i++;
      }


When j==1, the Alert comes: 2015.01.20 17:22:18.392    2014.11.12 00:47  FlokeBrok_TImeRAnge GBPUSD,M1: Alert: i= 295 1970.01.01 00:00:00

for every i.

The other values come OK. (5,15,30)

Is this a bug or I missing something here?

Greetings

BeLikewater

 

If you check the documentation for iTime you'll see:

Returned value

Time value for the bar of specified symbol with timeframe and shift. If local history is empty (not loaded), function returns 0. To check errors, one has to call the GetLastError() function. 

So when you call for a bar that isn't in the history, it is going to return 0.

When you convert 0 into time, you get the start of 1970. 

 

Thank you for your answer.

I will investigate the issue deeply.

Greetings

 

Ei man. You were right. I was a bit confussed with my m1 data. Seems like work like you  said now..

Greetings

BeLikewater