
#property indicator_chart_window

 int x = 1;  

extern color ColorHighlow = LimeGreen;
extern color ColorCloseopendodatni =LimeGreen ;
extern color ColorCloseopenujemny = Red;  

bool WaitForClose = true;  

extern bool HighLow = false;
extern int UpDown  =1; //+1 up -1 down
extern int dist = 0; //przesuniecie w pispach 
extern int Bars_to_count=10;
extern string Please_note ="1pip=10, 0,1pip=1";
extern int parametr_minus=0;
double Poin;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{

   return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
   for (int i = 0; i < Bars; i++)
   {
      ObjectDelete("" + TimeToStr(Time[i], TIME_DATE|TIME_MINUTES));
      ObjectDelete("" + TimeToStr(Time[i], TIME_DATE|TIME_MINUTES));
   }
   return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
   string name, length;
   
   int index = 0;
   double position;

   
   if (WaitForClose) index = true; 
   
   int counted_bars = IndicatorCounted();
   if (counted_bars > 0) counted_bars--;
   int limit = Bars - counted_bars;
   if (limit > Bars_to_count) limit = Bars_to_count;
     
   for (int i = 0; i <= limit; i++) 
   {
        
     if (UpDown>0){
         position = High[i]+(dist+20)*Point;
     }else{
         position = Low[i]-dist*Point;
     }      
     if(HighLow){ 
         if (High[i] - Low[i] >= x * Point) 
         {
            name = "" + TimeToStr(Time[i], TIME_DATE|TIME_MINUTES);
            length = DoubleToStr(MathRound((High[i] - Low[i]) / Point)- parametr_minus, 0);
            if (ObjectFind(name) != -1) ObjectDelete(name);
            ObjectCreate(name, OBJ_TEXT, 0, Time[i], position);
            ObjectSetText(name, length, 10, "Verdana", ColorHighlow);
         }
     }
     else
     {
            name = "" + TimeToStr(Time[i], TIME_DATE|TIME_MINUTES);
            length = DoubleToStr(MathAbs((Close[i] - Open[i])/ Point)- parametr_minus, 0);  
            if (ObjectFind(name) != -1) ObjectDelete(name);
            ObjectCreate(name, OBJ_TEXT, 0, Time[i], position);
            if (Close[i] - Open[i]>0)
            ObjectSetText(name, length, 10, "Verdana", ColorCloseopendodatni);
            if (Close[i] - Open[i]<0)
            ObjectSetText(name, length, 10, "Verdana", ColorCloseopenujemny);
            if (Close[i] - Open[i]==0  )
            ObjectSetText(name, length, 10, "Verdana", Yellow); 
      }
      
  }
   return(0);   
} 
//+------------------------------------------------------------------+ 