Download MetaTrader 5
To add comments, please log in or register
Speed up MQL5 Cloud Network. Install Strategy Tester Agent!
shuenmeau
13
shuenmeau 2016.06.20 03:35 

Sorry English is not my native language,  i try to explain what i want to say

as title,

I think that is the data in Period_H4 don't have been updated (BUT PERIOD_M15 have updated),

iMA(NULL,PERIOD_H4,13,8,MODE_EMA,PRICE_CLOSE,1) = > it should get the price of last candlestick (index 1) 

In fact, it get index 2 data if H4 period data array have been updated

RefreshRate() is not work for me

Any ideas are appreciated : )






Fernando Carreiro
1541
Fernando Carreiro 2016.06.20 06:26  

Remember, that there are 16 x M15 bars in a H4 bat, so even though the M15 bar has updated and closed, you will still be within the current H4 bar. Only after 16 x M15 bars will the H4 bar close.

If you want the MA value for the current H4 bar, then you must use a shift of [0] and not [1] (which is the previously closed bar). Also, "RefreshRates()" has no effect on the "iMA()" function because it ALWAYS returns current data.

iMA( NULL, PERIOD_H4, 13, 8, MODE_EMA, PRICE_CLOSE, 0 )
/
To add comments, please log in or register