open pending based of previous bar.. - page 2

 

i get this code from https://docs.mql4.com/predefined/variables/High. it's seems for getting higher of bar..

//---- maximums counting
   i=Bars-KPeriod;
   if(counted_bars>KPeriod) i=Bars-counted_bars-1;
   while(i>=0)
     {
      double max=-1000000;
      k = i + KPeriod-1;
      while(k>=i)
        {
         price=High[k];
         if(max<price) max=price;
         k--;
        }
      HighesBuffer[i]=max;
      i--;
     }
//----

what it's mean?i can not read all meaning..

i=total bar in the chart - KPeriod

what is the Kpriod?

then counted_bars is like total all bar or not?