Indicators: Multi Timeframe Moving Average

 

Multi Timeframe Moving Average:

The indicator displays the moving average for the selected timeframe.

Author: Il Anokhin

 
Thank You very much! I was looking this code.
 
Thank you so much, I really need this indicator. 
 
Nice code, thanks for sharing :)
 

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.

Files:
 

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);
Files:
mtf_ma.mq4  5 kb
 

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

Files:
mtf_ma.mq4  6 kb
 
nice job!! thanks for sharing
 
Many thank for your share! masterly!