Indicators: Multi Timeframe Moving Average
This indicator needs to be fixed more.... i've tried to place this indicator in my MT4.
First I saw this indicator is right. Then I saw the H4-EMA200 shown in daily chart is different from the origin EMA200 in H4 chart itself.
I think the issue is with these code:
if(Time[i]<iTime(NULL,TF,j)) j++; ma[i]=iMA(NULL,TF,PERIOD,SHIFT,METHOD,PRICE,j);
I changed them to this:
int theShift = iBarShift(NULL, TF, Time[i], false); ma[i]=iMA(NULL,TF,PERIOD,0,MODE_EMA,PRICE_CLOSE,theShift);
@Rocky
I think this is normal since you can't show the info correctly from lower time frame into higher time frame: https://www.forexfactory.com/thread/547970-mtf-moving-average-from-lower-time-frame
Nonetheless, here is the fully updated code that incorporates the segeo's code above for anyone who is interested (note: you have to click the "Go to discussion" link to see the attached file)
Multi Timeframe Moving Average:
The indicator displays the moving average for the selected timeframe.
Author: Il Anokhin