NRTR_ATR_STOP





//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers  2
#property indicator_color1 Blue
#property indicator_color2 Red

extern int ATR=50;
extern int Coeficient=3;

double Up[],Dn[];
//+------------------------------------------------------------------+
int init()
{
  SetIndexBuffer(0,Up);
  SetIndexStyle (0,DRAW_LINE);
  SetIndexEmptyValue(0,0.0);
  SetIndexLabel (0,"Up");

  SetIndexBuffer(1,Dn);
  SetIndexStyle (1,DRAW_LINE);
  SetIndexEmptyValue(1,0.0);
  SetIndexLabel (1,"Dn");

  return(0);
}
int deinit() { return(0); }
//+------------------------------------------------------------------+
int start()
{
  int i,limit;
  double REZ;
  string MODE="UP";

  limit=Bars-ATR;
  for(i=limit; i>=0; i--)
  {
    Dn[i]=0; Up[i]=0;
    REZ=Coeficient*iATR(NULL,0,ATR,i);
    if(MODE=="DOWN" &&  Low[i]>Dn[i+1]) { Up[i+1]= Low[i+1]-REZ; MODE="UP";   }
    if(MODE=="UP"   && High[i]<Up[i+1]) { Dn[i+1]=High[i+1]+REZ; MODE="DOWN"; }

    if(MODE=="UP")
    {
      if(Low[i+1]>Up[i+1]+REZ) Up[i]=Low[i+1]-REZ;
		  else Up[i]=Up[i+1];
		}

    if(MODE=="DOWN")
    {
     	if(High[i+1]<Dn[i+1]-REZ) Dn[i]=High[i+1]+REZ;
	    else Dn[i]=Dn[i+1];
	  }
  }
  return(0);
}
//+------------------------------------------------------------------+



Sample





Analysis



Market Information Used:

Series array that contains the lowest prices of each bar
Series array that contains the highest prices of each bar


Indicator Curves created:



Indicators Used:

Indicator of the average true range


Custom Indicators Used:

Order Management characteristics:

Other Features: