jtimpson Posted January 23, 2010 Report Share Posted January 23, 2010 I wish to be able to view a MACD 12,26,9 with signal line (based on a 5 minute time frame) in a one minute chart. Can anyone help me with this? Thanks, Jim Quote Link to comment Share on other sites More sharing options...
oleng Posted January 23, 2010 Report Share Posted January 23, 2010 Re: (Req) MTF MACD try : #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Silver #property indicator_color2 Red //---- input parameters extern int TimeFrame=0; extern int FastEMA=12; extern int SlowEMA=26; extern int SignalSMA=9; extern int applied_price=0; double ExtMapBuffer1[]; double ExtMapBuffer2[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicator line SetIndexStyle(0,DRAW_HISTOGRAM); SetIndexDrawBegin(1,SignalSMA); IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1); SetIndexBuffer(0,ExtMapBuffer1); SetIndexBuffer(1,ExtMapBuffer2); //---- name for DataWindow and indicator subwindow label switch(TimeFrame) { case 1 : string TimeFrameStr="Period_M1"; break; case 5 : TimeFrameStr="Period_M5"; break; case 15 : TimeFrameStr="Period_M15"; break; case 30 : TimeFrameStr="Period_M30"; break; case 60 : TimeFrameStr="Period_H1"; break; case 240 : TimeFrameStr="Period_H4"; break; case 1440 : TimeFrameStr="Period_D1"; break; case 10080 : TimeFrameStr="Period_W1"; break; case 43200 : TimeFrameStr="Period_MN1"; break; default : TimeFrameStr="Current Timeframe"; } IndicatorShortName("MTF_MACD("+FastEMA+","+SlowEMA+","+SignalSMA+") ("+TimeFrameStr+")"); } //---- return(0); //+------------------------------------------------------------------+ //| MTF MACD | //+------------------------------------------------------------------+ int start() { datetime TimeArray[]; int i,limit,y=0,counted_bars=IndicatorCounted(); // Plot defined time frame on to current time frame ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame); limit=Bars-counted_bars; for(i=0,y=0;i<limit;i++) { if (Time<TimeArray[y]) y++; ExtMapBuffer1=iMACD(NULL,TimeFrame,FastEMA,SlowEMA,SignalSMA,applied_price,0,y); ExtMapBuffer2=iMACD(NULL,TimeFrame,FastEMA,SlowEMA,SignalSMA,applied_price,1,y); } // return(0); } //+------------------------------------------------------------------+ Quote Link to comment Share on other sites More sharing options...
jtimpson Posted January 24, 2010 Author Report Share Posted January 24, 2010 Re: (Req) MTF MACD try : #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Silver #property indicator_color2 Red //---- input parameters extern int TimeFrame=0; extern int FastEMA=12; extern int SlowEMA=26; extern int SignalSMA=9; extern int applied_price=0; double ExtMapBuffer1[]; double ExtMapBuffer2[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicator line SetIndexStyle(0,DRAW_HISTOGRAM); SetIndexDrawBegin(1,SignalSMA); IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1); SetIndexBuffer(0,ExtMapBuffer1); SetIndexBuffer(1,ExtMapBuffer2); //---- name for DataWindow and indicator subwindow label switch(TimeFrame) { case 1 : string TimeFrameStr="Period_M1"; break; case 5 : TimeFrameStr="Period_M5"; break; case 15 : TimeFrameStr="Period_M15"; break; case 30 : TimeFrameStr="Period_M30"; break; case 60 : TimeFrameStr="Period_H1"; break; case 240 : TimeFrameStr="Period_H4"; break; case 1440 : TimeFrameStr="Period_D1"; break; case 10080 : TimeFrameStr="Period_W1"; break; case 43200 : TimeFrameStr="Period_MN1"; break; default : TimeFrameStr="Current Timeframe"; } IndicatorShortName("MTF_MACD("+FastEMA+","+SlowEMA+","+SignalSMA+") ("+TimeFrameStr+")"); } //---- return(0); //+------------------------------------------------------------------+ //| MTF MACD | //+------------------------------------------------------------------+ int start() { datetime TimeArray[]; int i,limit,y=0,counted_bars=IndicatorCounted(); // Plot defined time frame on to current time frame ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame); limit=Bars-counted_bars; for(i=0,y=0;i<limit;i++) { if (Time<TimeArray[y]) y++; ExtMapBuffer1=iMACD(NULL,TimeFrame,FastEMA,SlowEMA,SignalSMA,applied_price,0,y); ExtMapBuffer2=iMACD(NULL,TimeFrame,FastEMA,SlowEMA,SignalSMA,applied_price,1,y); } // return(0); } //+------------------------------------------------------------------+ Thanks Very Much to the good Oleng! I gave you Kudos. It works well! =D> (For any who use it, in the finished indicator settings, once the indicator is on the 1minute chart, change BOTH the time period and applied price inputs to 5 for a 5 minute MACD on the 1 minute chart) Note: I tried to upload the finished mq4 indicator, but got the following error message: "The file is too big, maximum allowed size is 1 KiB". :-? Quote Link to comment Share on other sites More sharing options...
jtimpson Posted January 24, 2010 Author Report Share Posted January 24, 2010 Re: (Req) MTF MACD Here is the link to the finished mq4 indicator: http://rapidshare.com/files/340171350/MTF_MACD.mq4.html Enjoy! :)>- Quote Link to comment Share on other sites More sharing options...
guspertiz Posted January 24, 2010 Report Share Posted January 24, 2010 Re: MTF MACD Multi_pair_MACD_mtf http://s41.radikal.ru/i092/1001/87/2411e3e98a32.jpg DOWNLOAD http://slil.ru/28539031 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.