//+------------------------------------------------------------------+
//|                                                      ProjectName |
//|                                      Copyright 2018, CompanyName |
//|                                       http://www.companyname.net |
//+------------------------------------------------------------------+
#property indicator_chart_window

extern double TopPrice = 1.2960;
extern double BottomPrice = 1.2744;
extern int Step_point = 90;

double gd_120;

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   if(Digits < 4)
      gd_120 = 0.01;
   else
      gd_120 = 0.0001;
   return (0);
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int deinit()
  {
   ObjectsDeleteAll();
   Comment("");
   return (0);
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {


   double ld_20 = BottomPrice;
   double ld_12 = TopPrice;
   double ld_28 = MathAbs(TopPrice - BottomPrice) / 8.0;
   double ld_36 = MathAbs(TopPrice - BottomPrice) / 3.0;

   int i= 1;
   double price = TopPrice - Step_point*Point();
   while(price > BottomPrice)
     {
      drawH("L_" + IntegerToString(i), price, Fuchsia, 2);
      i++;
      price -= Step_point*Point();
     }
   /*double ld_44 = ld_12 - ld_28;
   double ld_52 = ld_44 - ld_28;
   double ld_60 = ld_52 - ld_28;
   double ld_68 = ld_60 - ld_28;
   double ld_76 = ld_68 - ld_28;
   double ld_84 = ld_76 - ld_28;
   double ld_92 = ld_84 - ld_28;*/
   double ld_100 = ld_12 - ld_36;
   double ld_108 = ld_100 - ld_36;
   /*drawH("L1", ld_44, Fuchsia, 2);
   drawH("L2", ld_52, Fuchsia, 2);
   drawH("L3", ld_60, Fuchsia, 2);
   drawH("L4", ld_68, Fuchsia, 2);
   drawH("L5", ld_76, Fuchsia, 2);
   drawH("L6", ld_84, Fuchsia, 2);
   drawH("L7", ld_92, Fuchsia, 2); */
   drawH("L8", ld_100, Blue, 1);
   drawH("L9", ld_108, Blue, 1);
   drawH("TOP", TopPrice, White, 2);
   drawH("Bottom", BottomPrice, White, 2);


   return (0);
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void drawH(string as_0, double ad_8, color ai_16, int ai_20)
  {
   if(ObjectFind(as_0) != 0)
     {
      ObjectCreate(as_0, OBJ_HLINE, 0, 0, ad_8);
      ObjectSet(as_0, OBJPROP_COLOR, ai_16);
      ObjectSet(as_0, OBJPROP_WIDTH, ai_20);
     }
   if(ObjectGet(as_0, OBJPROP_PRICE1) != ad_8)
     {
      ObjectDelete(as_0);
      ObjectCreate(as_0, OBJ_HLINE, 0, 0, ad_8);
      ObjectSet(as_0, OBJPROP_COLOR, ai_16);
      ObjectSet(as_0, OBJPROP_WIDTH, ai_20);
     }
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void drawV(string as_0, int ai_8, color ai_12, int ai_16)
  {
   if(ObjectFind(as_0) != 0)
     {
      ObjectCreate(as_0, OBJ_VLINE, 0, ai_8, 0);
      ObjectSet(as_0, OBJPROP_COLOR, ai_12);
      ObjectSet(as_0, OBJPROP_WIDTH, ai_16);
     }
   if(ObjectGet(as_0, OBJPROP_TIME1) != ai_8)
     {
      ObjectDelete(as_0);
      ObjectCreate(as_0, OBJ_HLINE, 0, 0, ai_8);
      ObjectSet(as_0, OBJPROP_COLOR, ai_12);
      ObjectSet(as_0, OBJPROP_WIDTH, ai_16);
     }
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void draw(string as_0, double ad_8, int ai_16, double ad_20, int ai_28, color ai_32, int ai_36, int ai_40)
  {
   if(ObjectFind(as_0) != 0)
     {
      ObjectCreate(as_0, OBJ_TREND, 0, ai_16, ad_8, ai_28, ad_20);
      ObjectSet(as_0, OBJPROP_COLOR, ai_32);
      ObjectSet(as_0, OBJPROP_STYLE, ai_40);
      ObjectSet(as_0, OBJPROP_WIDTH, ai_36);
      ObjectSet(as_0, OBJPROP_RAY, FALSE);
     }
   if(ObjectGet(as_0, OBJPROP_PRICE1) != ad_8 || ObjectGet(as_0, OBJPROP_PRICE2) != ad_20)
     {
      ObjectDelete(as_0);
      ObjectCreate(as_0, OBJ_TREND, 0, ai_16, ad_8, ai_28, ad_20);
      ObjectSet(as_0, OBJPROP_COLOR, ai_32);
      ObjectSet(as_0, OBJPROP_STYLE, STYLE_SOLID);
      ObjectSet(as_0, OBJPROP_WIDTH, ai_36);
      ObjectSet(as_0, OBJPROP_RAY, FALSE);
     }
  }
//+------------------------------------------------------------------+
