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 a PERIOD_D1
parameter I always receive a value of 1970.01.01 00:00:00
.
Also GetLastError()
function returns a "not enough memory for history data
" message. It repeats all time even though tester was running over a 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 functions that take a timeframe parameter. Like for example iMA()
, iCCI()
, iRSI()
.
Documentation suggests that above functions can accept any timeframe value: https://docs.mql4.com/series/itime
I'll just add that my MetaTrader Terminal 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 setting or environmental restriction, I don't know?
Probably you do not have space at your disk or no data.
In order to run a MetaTrader Terminal Strategy Tester, you need data, you may check it by pressing F2
and select a symbol and a timeframe.
If there are no data (i.e. at D1
) - press a Download
button to get that data and then run the Strategy Tester again.
I hope that helps.