/*-----------------------------+ | | | Shared by www.Aptrafx.com | | | +------------------------------*/ //+------------------------------------------------------------------+ //| MACD# MTF.mq4 | //| Copyright © 2006, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #property link "cja" #property indicator_separate_window #property indicator_buffers 8 #property indicator_color1 Red #property indicator_color2 Red #property indicator_color3 DeepSkyBlue #property indicator_color4 DeepSkyBlue #property indicator_color5 LawnGreen #property indicator_color6 LawnGreen #property indicator_color7 Orange #property indicator_color8 Orange #property indicator_width1 1 #property indicator_style2 2 #property indicator_width3 1 #property indicator_style4 2 #property indicator_width5 1 #property indicator_style6 2 #property indicator_width7 1 #property indicator_style8 2 #property indicator_level1 0 //---- input parameters extern int FastEMA=12; //8 Faster settings extern int SlowEMA=26; //17 extern int SignalSMA=9; //9 // Different Currencies may need different Factors to help // separate the different MACD lines - raise the Factor # on the // largest moving MACD lines to enlarge the view of the other 3 MACD Timeframes. extern double MACD_FactorH1 =12; extern double MACD_FactorM15=6; extern double MACD_FactorM5=2; extern double MACD_FactorM1=1; //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double ExtMapBuffer4[]; double ExtMapBuffer5[]; double ExtMapBuffer6[]; double ExtMapBuffer7[]; double ExtMapBuffer8[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorShortName("MACD MTF"); //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,ExtMapBuffer2); SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(2,ExtMapBuffer3); SetIndexStyle(3,DRAW_LINE); SetIndexBuffer(3,ExtMapBuffer4); SetIndexStyle(4,DRAW_LINE); SetIndexBuffer(4,ExtMapBuffer5); SetIndexStyle(5,DRAW_LINE); SetIndexBuffer(5,ExtMapBuffer6); SetIndexStyle(6,DRAW_LINE); SetIndexBuffer(6,ExtMapBuffer7); SetIndexStyle(7,DRAW_LINE); SetIndexBuffer(7,ExtMapBuffer8); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- IndicatorShortName("MACD MTF"); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); // Start of LABELS double MyFValue = Period(); ObjectCreate("MACDMTF4", OBJ_LABEL, WindowFind("MACD MTF"), 0, 0); ObjectSetText("MACDMTF4",DoubleToStr(MyFValue,Digits-4), 15, "Arial", DarkTurquoise); ObjectSet("MACDMTF4", OBJPROP_CORNER, 0); ObjectSet("MACDMTF4", OBJPROP_XDISTANCE, 430); ObjectSet("MACDMTF4", OBJPROP_YDISTANCE, 0); ObjectCreate("MACDMTF5", OBJ_LABEL, WindowFind("MACD MTF"), 0, 0);//1hr ObjectSetText("MACDMTF5","Curr Period", 12, "Arial",DarkTurquoise); ObjectSet("MACDMTF5", OBJPROP_CORNER, 0); ObjectSet("MACDMTF5", OBJPROP_XDISTANCE, 340); ObjectSet("MACDMTF5", OBJPROP_YDISTANCE, 0); ObjectCreate("MACDMTF", OBJ_LABEL, WindowFind("MACD MTF"), 0, 0);//1hr ObjectSetText("MACDMTF","H1", 15, "Arial",Red ); ObjectSet("MACDMTF", OBJPROP_CORNER, 0); ObjectSet("MACDMTF", OBJPROP_XDISTANCE, 540); ObjectSet("MACDMTF", OBJPROP_YDISTANCE, 0); ObjectCreate("MACDMTF1", OBJ_LABEL, WindowFind("MACD MTF"), 0, 0);//15min ObjectSetText("MACDMTF1","M15", 15, "Arial", DodgerBlue); ObjectSet("MACDMTF1", OBJPROP_CORNER, 0); ObjectSet("MACDMTF1", OBJPROP_XDISTANCE, 580); ObjectSet("MACDMTF1", OBJPROP_YDISTANCE, 0); ObjectCreate("MACDMTF2", OBJ_LABEL, WindowFind("MACD MTF"), 0, 0);//5min ObjectSetText("MACDMTF2","M5", 15, "Arial", Chartreuse); ObjectSet("MACDMTF2", OBJPROP_CORNER, 0); ObjectSet("MACDMTF2", OBJPROP_XDISTANCE, 640); ObjectSet("MACDMTF2", OBJPROP_YDISTANCE, 0); ObjectCreate("MACDMTF3", OBJ_LABEL, WindowFind("MACD MTF"), 0, 0);//1min ObjectSetText("MACDMTF3","M1", 15, "Arial",Orange ); ObjectSet("MACDMTF3", OBJPROP_CORNER, 0); ObjectSet("MACDMTF3", OBJPROP_XDISTANCE, 690); ObjectSet("MACDMTF3", OBJPROP_YDISTANCE, 0); // End of LABELS //---- for(int i=Bars;i>=0;i--){ ExtMapBuffer1[i]=(iMACD(NULL,PERIOD_H1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,i)/MACD_FactorH1); ExtMapBuffer2[i]=(iMACD(NULL,PERIOD_H1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,i)/MACD_FactorH1); ExtMapBuffer3[i]=(iMACD(NULL,PERIOD_M15,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,i)/MACD_FactorM15); ExtMapBuffer4[i]=(iMACD(NULL,PERIOD_M15,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,i)/MACD_FactorM15); ExtMapBuffer5[i]=(iMACD(NULL,PERIOD_M5,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,i)/MACD_FactorM5); ExtMapBuffer6[i]=(iMACD(NULL,PERIOD_M5,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,i)/MACD_FactorM5); ExtMapBuffer7[i]=(iMACD(NULL,PERIOD_M1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,i)/MACD_FactorM1); ExtMapBuffer8[i]=(iMACD(NULL,PERIOD_M1,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,i)/MACD_FactorM1); } } //---- return(0); //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Indicator Curves created:
Implements a curve of type DRAW_LINE
Indicators Used:
MACD Histogram
Custom Indicators Used:
Order Management characteristics:
Other Features: