#property indicator_chart_window
#property  indicator_buffers 2
#property indicator_color1 Gray
#property indicator_color2 Gray

//extern ENUM_TIMEFRAMES TF=PERIOD_D1;
extern int ATRPeriod = 12;
extern int xdistance = 100;
extern int ydistance = 100;
extern double ATRFactor = 1;

double atrHigh[], atrLow[];

int init()
  {
   IndicatorBuffers(2);
   
   SetIndexBuffer(0,atrHigh);
   SetIndexBuffer(1,atrLow);   
   
   SetIndexStyle(0,DRAW_LINE,STYLE_DOT,1);
   SetIndexStyle(1,DRAW_LINE,STYLE_DOT,1);
   return(0);
  }

int start()
  {
   int i, counted_bars=IndicatorCounted();
   double atr;
   i = Bars-counted_bars-1;
   while(i>=0)
     {
        
       atr = ATRFactor*iATR(NULL,0,ATRPeriod,i);
       atrHigh[i] = Close[i] + atr;
       atrLow[i] = Close[i] - atr;
       
       //lorant testing edit
       //atr = ATRFactor*iATR(NULL,TF,ATRPeriod,i);
       //atrHigh[i] = iClose(Symbol(),TF,i) + atr;
       //atrLow[i] = iClose(Symbol(),TF,i) - atr;
       i--;
     }
   return(0);
  }

