Download MetaTrader 5
To add comments, please log in or register
Are you a good trader? Become a signals provider and make even more money!
pankis
10
pankis 2016.12.01 11:11 

Hello.

I have problem with getting time values for bar in higher timeframes. I'm testing my expert advisor in tester and when I try to use function iTime with PERIOD_D1 parameter I always recessive value 1970.01.01 00:00:00. Also GetLastError method returns "not enough memory for history data" message. It repeats all time even though tester running over few days data. Bellow is code I try to run:

 

datetime t = iTime(Symbol(),PERIOD_D1, 0);

Print("Trend tick time: " + t);

int check1 = GetLastError();

if(check1 != ERR_NO_ERROR) Print("Error: ", ErrorDescription(check1));

 

And I'm getting output like this:

 

0             22:33:24               2016.06.29 08:00  HLR FDE30,M1: Trend tick time: 1970.01.01 00:00:00

0             22:33:24               2016.06.29 08:00  HLR FDE30,M1: Error: not enough memory for history data

0             22:33:25               2016.06.30 08:00  HLR FDE30,M1: Trend tick time: 1970.01.01 00:00:00

0             22:33:25               2016.06.30 08:00  HLR FDE30,M1: Error: not enough memory for history data

0             22:33:26               2016.07.01 08:00  HLR FDE30,M1: Trend tick time: 1970.01.01 00:00:00

0             22:33:26               2016.07.01 08:00  HLR FDE30,M1: Error: not enough memory for history data

[...]

 

And the same thing happens when I'm calling other build-in methods that's take timeframe parameter. Like for example iMA, iCCI, iRSI


Documentation suggest that above functions can accept any timeframe value: https://docs.mql4.com/series/itime


I'll just add that my Meta Trader chart settings are: Max bars in history: 1250000; Max bars in chart: 1250000


Do you have any suggestions how I can resolve this problem?

Maybe there is some other settings or environmental restrictions I don't know? 

iTime - Timeseries and Indicators Access - MQL4 Reference
iTime - Timeseries and Indicators Access - MQL4 Reference
  • docs.mql4.com
iTime - Timeseries and Indicators Access - MQL4 Reference
Alain Verleyen
Moderator
28522
Alain Verleyen 2016.12.01 12:37  

Weird.

If you open a live chart on that symbol for D1, is it displaying correctly ?

Is it only for that symbol ?

Are you connected to your broker ?

pankis
10
pankis 2016.12.02 09:28  

Hey Alain,

Thanks for your replay.

Problem was solved. I had to download historical data for other time periods in Meta Trader History Center. 

Alain Verleyen
Moderator
28522
Alain Verleyen 2016.12.02 10:07  
pankis:

Hey Alain,

Thanks for your replay.

Problem was solved. I had to download historical data for other time periods in Meta Trader History Center. 

Argh...was so obvious I didn't think to say it :-D
/
To add comments, please log in or register