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 information in 1H and 4H as well.
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 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
double H4High = iHigh(NULL,PERIOD_H4,0); // Symbol NULL for default, PERIOD_H4 refers to H4 timeframe, and 0 refers to candle
Thank you very much!