//+------------------------------------------------------------------+ //| Cronex Impulse MACD.mq4 | //| Copyright © 2007, Cronex. | //| http://www.metaquotes.net/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2008, Cronex" #property link "http://www.metaquotes.net/" //---- indicator settings #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 SteelBlue #property indicator_color2 DarkOrange //---- indicator parameters extern int MasterMA=34; extern int SignalMA=9; //---- indicator buffers double MacdDivrBuffer[]; double SignalBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicator buffers mapping SetIndexBuffer(0,MacdDivrBuffer); SetIndexBuffer(1,SignalBuffer); //---- drawing settings SetIndexStyle(0,DRAW_HISTOGRAM); SetIndexStyle(1,DRAW_LINE); SetIndexEmptyValue(0,0) ; IndicatorDigits(Digits+1); //---- name for DataWindow and indicator subwindow label IndicatorShortName("Impulce MACD("+MasterMA+","+SignalMA+")"); SetIndexLabel(0,"Impulce MACD"); SetIndexLabel(1,"Signal"); //---- initialization done return(0); } //+------------------------------------------------------------------+ //| Moving Averages Convergence/Divergence | //+------------------------------------------------------------------+ int start() { int limit; int counted_bars=IndicatorCounted(); double HiInd,LoInd,MasterInd; //---- 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; iHiInd) MacdDivrBuffer[i]=MasterInd-HiInd; if(MasterInd