PERIOD_H8

 

I have written an EA in MQL4 which returns some information about the previous bar with the following lines:

double H1 = iHigh(NULL, PERIOD_H4, 1);
double L1 = iLow(NULL, PERIOD_H4, 1);
double R1 = H1 - L1;
double HC = (H1 - C1) / R1;


This works fine there is no problem.

However if I change this code to use PERIOD_H8 (as below), when executing the last line of code I receive a zero divide error:


double H1 = iHigh(NULL, PERIOD_H8, 1);
double L1 = iLow(NULL, PERIOD_H8, 1);
double R1 = H1 - L1;
double HC = (H1 - C1) / R1;


The same thing happens if I use PERIOD_H12 -

Does anybody know why this is? Is it a broker specific issue or something issue with using these particular timeframes?

 
kieranf:

I have written an EA in MQL4 which returns some information about the previous bar with the following lines:


This works fine there is no problem.

However if I change this code to use PERIOD_H8 (as below), when executing the last line of code I receive a zero divide error:



The same thing happens if I use PERIOD_H12 -

Does anybody know why this is? Is it a broker specific issue or something issue with using these particular timeframes?

There is no H8 or H12 timeframes with MT4. Only with offline charts.
 
Thanks!
Reason: