//+------------------------------------------------------------------+
//|                                                   horiz line.mq4 |
//+------------------------------------------------------------------+

#property indicator_chart_window

extern int        LinePosition      = 50;
extern color      LineColor         = White;
extern int        LineWidth         = 1;
extern int        LineStyle         = 0;

string   objname = "horiz line-1";

//+------------------------------------------------------------------+
int init()  {
//+------------------------------------------------------------------+
  return(0);
}

//+------------------------------------------------------------------+
int deinit()  {
//+------------------------------------------------------------------+
  ObjectDelete(objname);
  return(0);
}

//+------------------------------------------------------------------+
int start()  {
//+------------------------------------------------------------------+
  double maxp     = WindowPriceMax();
  double minp     = WindowPriceMin();
  if (ObjectFind(objname) < 0)  {
    ObjectCreate(objname,OBJ_HLINE,0,0,minp+(maxp-minp)*LinePosition/100);
    ObjectSet(objname,OBJPROP_COLOR,LineColor);
    ObjectSet(objname,OBJPROP_WIDTH,LineWidth);
    ObjectSet(objname,OBJPROP_STYLE,LineStyle);
  }  
  ObjectMove(objname,0,0,minp+(maxp-minp)*LinePosition/100);
  return(0);
}



