Greatings pro's. I am trying to access the close of a higher timeframe in an indicator. Specifically, I want to calculate the value of the 20 period SMA on the M5 as it was on the M1. So what I would do is take the previous 19 closes of the M5 and average those in with the closes of the M1 that are within the most recent M5 candle. The only way I have figured out so far to get the closes of a higher timeframe is to use the iMA function on the higher timeframe with a period of 1. Is there a more efficient/correct way to access the higher timeframe data?
Also, what would be the best way to determine if one of the M1 candles is within an M5? I guess check if the open time of the M1 is >= the M5 open and the close of the M1 is <= the M5. I just answered that.
double iMA( string symbol, int timeframe, int period, int ma_shift, int ma_method, int applied_price, int shift)
use this code to get the high and low on the current M5 bar.
double 5_Min_Low = iLow( NULL , PERIOD_M5 ,0 )
double 5_Min_High = iHigh(( NULL , PERIOD_M5 ,0 )
Please enable the necessary setting in your browser, otherwise you will not be able to log in.