//+------------------------------------------------------------------+ //| MACD cross.mq4 | //| Copyright © 2006, Eli hayun | //| | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, Eli hayun" #property link "" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_color2 Red //---- input parameters extern int fastEma=38; extern int slowEma=120; extern int macdSma=20; extern bool UseAlert=false; //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,233); SetIndexBuffer(0,ExtMapBuffer1); SetIndexEmptyValue(0,0.0); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,234); SetIndexBuffer(1,ExtMapBuffer2); SetIndexEmptyValue(1,0.0); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ 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; //---- main loop for(int i=0; i macdSignal0 && macdMain2 < macdSignal2) ExtMapBuffer1[i] = iLow(NULL, 0, i+1); if (macdMain0 < macdSignal0 && macdMain2 > macdSignal2) ExtMapBuffer2[i] = iHigh(NULL, 0, i+1); } return(0); } //+------------------------------------------------------------------+