//+------------------------------------------------------------------+ //| mc.mq4 | //| Copyright © 2011, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2011, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #property indicator_separate_window #property indicator_buffers 4 #property indicator_color1 Gray #property indicator_color2 White #property indicator_color3 MediumBlue #property indicator_color4 Aqua #property indicator_width1 2 extern int FastEMA=12; extern int SlowEMA=26; extern int SignalSMA1=9; extern int SignalSMA2=25; //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double ExtMapBuffer4[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators IndicatorShortName("MACD++ ("+FastEMA+","+SlowEMA+","+SignalSMA1+","+SignalSMA2+")"); SetIndexStyle(0,DRAW_HISTOGRAM); SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,ExtMapBuffer2); SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(2,ExtMapBuffer3); SetIndexStyle(3,DRAW_HISTOGRAM); SetIndexBuffer(3,ExtMapBuffer4); //SetIndexEmptyValue(2,0.0); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); int limit; //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; //---- macd counted in the 1-st buffer for(int i=0; i