//+------------------------------------------------------------------+ //| w35260_ws_MA_or_SDL.mq4 | //| IgorS | //| igor.senych@gmail.com | //+------------------------------------------------------------------+ #property copyright "IgorS" #property link "igor.senych@gmail.com" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Green #property indicator_color2 Red //---- input parameters extern int w_period1 = 89; extern int w_price1 = 0; extern int w_mode1 = 3; extern int w_period2 = 144; extern int w_price2 = 0; extern int w_mode2 = 3; extern bool MA = false; extern int ma_period = 55; extern int ma_price = 0; extern int ma_mode = 3; extern int sl_period = 144; extern int sl_price = 0; extern int sl_mode = 0; extern int dev = 1; double val1 = 0, val2 = 0, MA_prv = 0, MA_cur = 0; //---- buffers double ExtMapBuffer0[]; double ExtMapBuffer1[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE,EMPTY,2); SetIndexBuffer(0,ExtMapBuffer0); SetIndexStyle(1,DRAW_LINE,EMPTY,2); SetIndexBuffer(1,ExtMapBuffer1); //---- return(0); } //+------------------------------------------------------------------+ //| Custor 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); if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; for(int i=0; iMA_prv) { ExtMapBuffer1[i]=EMPTY_VALUE; } } //---- done return(0); } //+------------------------------------------------------------------+