When the M15 have a new bar, I call iMA to get index data in H4 period, the price is wrong

 

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 : )






 

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 )
Reason: