kino_2ATRaboveLimit





//+------------------------------------------------------------------+
//|      kinonen's indic  to see if 2 ATR are above/under a limitAtr  |
//|                      Copyright © 2009, Pharmacien@dejante.com    |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
 // you are asking if ATR is above/under limitXX ?

#property  copyright "Copyright © 2008, MetaQuotes Software Corp."
#property  link      "http://www.metaquotes.net/"
//---- indicator settings
#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 1

#property  indicator_buffers 3
#property  indicator_color1  DarkGreen
#property  indicator_color2  Crimson
#property  indicator_color3  Yellow

//---- indicator parameters      
extern int ATR1=6;
extern int ATR2=36;
extern double limitAtr=0.0015;
//extern bool SoundON=true;

//---- indicator buffers
double   ExtBuffer1[];
double   ExtBuffer2[];
double   ExtBuffer3[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- drawing settings
   SetIndexStyle (0,DRAW_HISTOGRAM, EMPTY,4,DarkGreen);
   SetIndexBuffer(0,ExtBuffer1);
   SetIndexStyle (1,DRAW_HISTOGRAM, EMPTY,4,Crimson);
   SetIndexBuffer(1,ExtBuffer2);
   SetIndexStyle (2,DRAW_HISTOGRAM, EMPTY,4,Yellow);
   SetIndexBuffer(2,ExtBuffer3);
   //SetIndexStyle (3,DRAW_HISTOGRAM, EMPTY,4,Lime);
   //SetIndexBuffer(3,ExtBuffer4);
   //SetIndexStyle (4,DRAW_HISTOGRAM, EMPTY,4,Red);
   //SetIndexBuffer(4,ExtBuffer5);
//---- names
   IndicatorShortName("2 ATR above/under "+limitAtr);
   SetIndexLabel(0,"2 ATR are above "+limitAtr);
   SetIndexLabel(1,"2 ATR are below " +limitAtr);
   SetIndexLabel(2,"ATRs are each side of " +limitAtr);
   
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Moving Averages                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- 
   for(int i=0; i<limit; i++)
   
   //ATRs are >0  
     // 2ATRs are >limitATR   
     
        if (iATR(NULL,0,ATR1,i)>limitAtr && iATR(NULL,0,ATR2,i)>limitAtr )  
        {
        ExtBuffer1[i]=1;
        }
        else
        if (iATR(NULL,0,ATR1,i)<limitAtr && iATR(NULL,0,ATR2,i)<limitAtr )  
        {
        ExtBuffer2[i]=1;
        }
        else
       
       if (iATR(NULL,0,ATR1,i)>limitAtr && iATR(NULL,0,ATR2,i)<limitAtr )  
        {
        ExtBuffer3[i]=1;
        }
        
        else
       if (iATR(NULL,0,ATR1,i)<limitAtr && iATR(NULL,0,ATR2,i)>limitAtr )  
        {
        ExtBuffer3[i]=1;
        }
            
    
                
       
   return(0);
  }
  
//+------------------------------------------------------------------+



Sample





Analysis



Market Information Used:



Indicator Curves created:



Indicators Used:

Indicator of the average true range


Custom Indicators Used:

Order Management characteristics:

Other Features: