How to force MT4 to download lower timeframe data (eg. M1) when on a higher timeframe chart (eg. H1)

 

The iTime() function seems to be returning valid dates for some currency pairs (eg. "EURUSDpro", "GBPUSDpro") but not others (eg. "USDJPYpro").

I am using it as follows:

datetime result = iTime(NULL, PERIOD_M1, 0);

I've already checked that M1 data is available in the History Center, so that's not the cause.

When it works, it returns today's date at PERIOD_M1 granularity, but when it fails, it returns: 1970.01.01 00:00:00.

Is this a bug in the function?

 
Unless the chart is that specific pair/TF, you must handle 4066/4073 errors. See Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum
 
whroeder1:
Unless the chart is that specific pair/TF, you must handle 4066/4073 errors. See Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum


The chart is always that specific pair, but it is not set to M1 TF when this issue happens.

Although switching to M1 TF fixes the problem, I'd like to figure out how I can force MT4 to download historic data at the lowest possible granularity (PERIOD_M1) while at a higher TF, say, H1 or H4.

 
imadmg: I'd like to figure out how I can force MT4 to download historic data at the lowest possible granularity (PERIOD_M1) while at a higher TF, say, H1 or H4.
Which is exactly what I gave you.