How to have EA attached to a chart look at different time frames ?

 

Hi Folks,

I am writing some code for an EA, and am wondering how can I have the EA look at different time frames other than the time frame of the chart it is attached to.

For example, if I attach my EA to a H1 chart. And the EA is coded with time[1], open[1] etc, these will be referring to the H1 candles.

Is it possible for the EA to look at multiple time frames ? Say the opening price, closing price of M15 candles as well.

Many thanks, Hip

 

I'm not an expert but you could modify your code using

iOpen(Symbol(),Period_M15,i)

or iClose respectivly.

where i is the number of the bar (0==current bar).

This way you'll get the opening and closing prices of the Bar i at time frame Period_M15 for your calculation in your EA.


EDIT: See also: https://docs.mql4.com/series

 
Wooah....that's just what I need. Thanks pal for pointing me in the correct direction.
Reason: