//+------------------------------------------------------------------+ // you are free to use and improve, however I would appreciate you send me your versions at gideonsmolders(@)gmail.com //ATTENTION: error messages: zero divide #property copyright "Gideon Smolders,2005" #property link "gideonsmolders(@)gmail.com" //---- indicator settings #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Olive #property indicator_color2 FireBrick //---- indicator parameters extern int FastEMA=12; extern int SlowEMA=26; extern int SignalSMA=9; extern double DivCalc1=0.3; extern double DivCalc2=0.35; extern double DivCalc3=0.45; extern double DivCalc4=0.60; //---- indicator buffers double ind_buffer1a[]; double ind_buffer1b[]; double ind_buffer2[]; double ind_buffer3[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- 2 additional buffers are used for counting. IndicatorBuffers(4); //---- drawing settings SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,108); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,108); //---- 3 indicator buffers mapping if(!SetIndexBuffer(0,ind_buffer1a) && !SetIndexBuffer(1,ind_buffer1b) && !SetIndexBuffer(2,ind_buffer2) && !SetIndexBuffer(3,ind_buffer3)) Print("cannot set indicator buffers!"); //---- name for DataWindow and indicator subwindow label IndicatorShortName("MACDsignalsv0.2("+FastEMA+","+SlowEMA+","+SignalSMA+")"); //---- initialization done return(0); } //+------------------------------------------------------------------+ //| Moving Average | //+------------------------------------------------------------------+ int start() { int limit; int counted_bars=IndicatorCounted(); //---- check for possible errors if(counted_bars<0) return(-1); //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; //---- macd counted in the 1-st additional buffer for(int i=0; iprev1_value && prev1_valueDivCalc1) || (value>prev1_value && prev1_value>prev2_value && prev2_valueDivCalc2) || (value>prev1_value && (prev1_valueprev2_value) && prev2_value>prev3_value && prev3_valueDivCalc3) || (value>prev1_value && prev1_value>prev2_value && prev2_value>prev3_value && div_value1>DivCalc4) ) ind_buffer1a[i]=Low[i]-2*Point; if ((valueprev2_value && prev2_value>prev3_value && div_value1>DivCalc1) || (valueprev3_value && div_value2>DivCalc2) || (valueprev2_value || prev1_valueprev4_value && div_value3>DivCalc3) || (valueDivCalc4)) ind_buffer1b[i]=High[i]+2*Point; } //---- done return(0); } //+------------------------------------------------------------------+