//+------------------------------------------------------------------+ //| MACD+MA.mq4 | //| Copyright © 2006, Victor Chebotariov | //| http://www.chebotariov.com/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, Victor Chebotariov" #property link "http://www.chebotariov.com/" extern int period = 14; extern int ma_shift = 0; extern int ma_method = 3;//0-3 extern int applied_price_ma = 0;//0-6 extern int fast_ema_period = 12; extern int slow_ema_period = 26; extern int applied_price_macd = 0; #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_color2 Red //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int init() { IndicatorShortName("MACD+MA"); //---- indicators SetIndexStyle(0,DRAW_ARROW,EMPTY,1,Blue); SetIndexArrow(0,159); SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(1,DRAW_ARROW,EMPTY,1,Red); SetIndexArrow(1,159); SetIndexBuffer(1,ExtMapBuffer2); //---- return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { int i,counted_bars=IndicatorCounted(); //---- i=Bars-counted_bars-1; while(i>=0) { double MA_0 = iMA(NULL,0,period,ma_shift,ma_method,applied_price_ma,i); double MA_1 = iMA(NULL,0,period,ma_shift,ma_method,applied_price_ma,i+1); double MACD_0 = iMACD(NULL,0,fast_ema_period,slow_ema_period,9,applied_price_macd,MODE_MAIN,i); double MACD_1 = iMACD(NULL,0,fast_ema_period,slow_ema_period,9,applied_price_macd,MODE_MAIN,i+1); if(MA_0>MA_1 && MACD_0>MACD_1) { ExtMapBuffer2[i]=High[i]; } if(MA_0