//+------------------------------------------------------------------+
//|                                                           10.mq4 |
//|                      Copyright © 2007, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
extern  bool is_alert=1;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW,0,1);
   SetIndexArrow(0,233);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexEmptyValue(0,0.0);
   SetIndexStyle(1,DRAW_ARROW,0,1);
   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    counted_bars=IndicatorCounted();
//----
   if (counted_bars<0) return(-1);
   int pos=Bars-counted_bars-1;
//----
    while(pos>0)
    {
    double lag1=iCustom(NULL,0,"Laguerre",0.65,95000,0,pos);
    double lag2=iCustom(NULL,0,"Laguerre",0.85,95000,0,pos);
    double lag2p=iCustom(NULL,0,"Laguerre",0.85,95000,0,pos+1);
    double mas=iMACD(NULL,0,60,200,1,0,1,pos);
    int st=iStochastic(NULL,0,14,3,3,MODE_SMA,0,MODE_MAIN,pos);
    int stp=iStochastic(NULL,0,14,3,3,MODE_SMA,0,MODE_MAIN,pos+1);
    if (lag1>0.15 && lag2 <0.15 &&  st>50 && stp<=50 && mas>0 && lag2>=lag2p)
       {
       
       ExtMapBuffer1[pos]=Low[pos]-10* Point;
       if ( pos< 3 && is_alert) Alert("Buy signal in safe entry at " +Symbol());
       
       }
    
    if (lag1<0.85 && lag2 >0.85 &&  st<50 && stp>=50 && mas<0)
       {
       
       ExtMapBuffer2[pos]=High[pos]+10* Point;
       if ( pos< 3 && is_alert) Alert("Sell signal in safe entry at " +Symbol());
       
       }
    pos--;
    
    
    
    }
   return(0);
  }
//+------------------------------------------------------------------+