//added autorefresh 
//added 4 or 5 digits broker 
//added Countbars
//added ArrowUp Arrowdown
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_width1 0
#property indicator_color2 Lime 
#property indicator_width2 0


extern int barsLeftOfCurrent =0;
extern int barsRightOfCurrent = 13;
extern int Arrowup=108;
extern int Arrowdown=108;
extern bool Five_digit_broker=true;
extern int distance = 10;
extern int Countbars=300;


double b1[];
double b2[];

int init()  {
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,Arrowup);
   SetIndexArrow(0,Arrowdown);
   SetIndexBuffer(0,b1);
   SetIndexBuffer(1,b2);
   return(0); 
}
int start() {
   int k,i,j,limit,hhb,llb,limit2,Distancefin;
   
   int counted_bars = IndicatorCounted();
   if (counted_bars < 0) 
   return (-1);
   if (counted_bars> 0) 
   counted_bars--;
   limit =Countbars - counted_bars;
   if (limit2 < Countbars - 1)
    limit = Countbars - 1;  
if (Five_digit_broker==true){
Distancefin=distance*10;
}
else{
Distancefin=distance;
}


   for (i=limit;i>=1;i--)   {
      b1[i]=0;
      b2[i]=0;
      hhb = iHighest(0,0,MODE_HIGH,barsLeftOfCurrent + 1 + barsRightOfCurrent,i - barsRightOfCurrent);
      llb = iLowest(0,0,MODE_LOW,barsLeftOfCurrent + 1 + barsRightOfCurrent,i - barsRightOfCurrent);

      if (i==hhb && i!=0)
         b1[i]=High[i]+Distancefin*Point;
      if (i==llb)
         b2[i]=Low[i]-Distancefin*Point;
   }
    if (i> limit2) 
   limit2= i;
   return(0);
}


