Navigation:Home > Content >

iKarakatitsa_adxdiFltmom.mq4

Time: 2015-05-24 | Download file:iKarakatitsa_adxdiFltmom.mq4

//+------------------------------------------------------------------+
//|                        Karacatica                                |
//|                        Дмитрий                                   |
//+------------------------------------------------------------------+
//mod2009tsd
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
//----
extern int       iPeriod=14;
extern int   adxLvFilter=20;    //if=0 no filter
extern int    diLvFilter=20;    
extern bool  adxDirectiON =true;  
double ExtMapBuffer1[];
double ExtMapBuffer2[];

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
  int init()
  {
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,241);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexEmptyValue(0,0.0);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,242);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexEmptyValue(1,0.0);
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
  int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();  // определим количество просчитаных баров у индикатора
   limit=Bars-counted_bars;              // определяем границу до которой рассчитываем значения индикатора
   if(limit >Bars-2)limit=Bars-2;
   static int ltr;
     for(int i=limit-1;i>=0;i--)
     {
      if(ExtMapBuffer1[i+1]!=0 && ExtMapBuffer1[i+1]!=EMPTY_VALUE)ltr=1;
      if(ExtMapBuffer2[i+1]!=0 && ExtMapBuffer2[i+1]!=EMPTY_VALUE)ltr=2;
      double adx0=iADX(NULL,0,iPeriod,0,MODE_MAIN,i);
      double adx1=iADX(NULL,0,iPeriod,0,MODE_MAIN,i+1);
      double pdi=iADX(NULL,0,iPeriod,0,MODE_PLUSDI,i);
      double mdi=iADX(NULL,0,iPeriod,0,MODE_MINUSDI,i);
      bool adxLvFlt=false; bool diLvFlt=false; bool adxdr=false;
      if (adx0>adxLvFilter||adxLvFilter==0)adxLvFlt=true;
      if (pdi||mdi>diLvFilter||adxLvFilter==0)diLvFlt =true;
      if (!adxDirectiON||adxDirectiON &&adx0>adx1)adxdr=true; 
      ExtMapBuffer1[i]=EMPTY_VALUE;
      ExtMapBuffer2[i]=EMPTY_VALUE;
      if(Close[i]>Close[i+iPeriod] &&pdi>mdi &&adxLvFlt &&diLvFlt &&adxdr &<r!=1)
      ExtMapBuffer1[i]=Low[i]-iATR(NULL,0,5,i);
      if(Close[i]        

Recommend