How to Hardcode Multi-timeframes in our EA?

 

Hi Pros,

I'm trying to make an EA depend on 2 time frames at the same time. In other words, I want my EA to check conditions in 1H and if the signal says to open for example BUY order, next I want it to check 4H time frame and if the 4H chart confirmed BUY signal as well then it opens BUY order.

I'm Newbie and have no idea about how to do this. Shall I search for a function? indicator? or...? Kindly note my EA opens orders real time, I mean I need the candle[0] information in 1H and 4H as well.

Any idea?

 

There are functions such as iHigh, iLow, iClose, iOpen and iTime for you to retrieve the price data of any timeframe you specified. Here's an example to get the latest High prices of candle[0] for H1 and H4:

double H1High = iHigh(NULL,PERIOD_H1,0); // Symbol NULL for default, PERIOD_H1 refers to H1 timeframe, and 0 refers to candle[0]
double H4High = iHigh(NULL,PERIOD_H4,0); // Symbol NULL for default, PERIOD_H4 refers to H4 timeframe, and 0 refers to candle[0]
 
Seng Joo Thio:

There are functions such as iHigh, iLow, iClose, iOpen and iTime for you to retrieve the price data of any timeframe you specified. Here's an example to get the latest High prices of candle[0] for H1 and H4:

Yeahhhhh

Thank you very much!

Reason: