MQL5: Create Horizontal line with give price

 void CreateRedLine(double price)

  {

   string lineName = "RedLine_" + DoubleToString(price, _Digits);

   if(ObjectFind(0, lineName) != -1)

     {

      ObjectDelete(0, lineName);

     }

   if(ObjectCreate(0, lineName, OBJ_HLINE, 0, 0, price))

     {

      ObjectSetInteger(0, lineName, OBJPROP_COLOR, clrRed);

      ObjectSetInteger(0, lineName, OBJPROP_WIDTH, 2);

      ObjectSetInteger(0, lineName, OBJPROP_STYLE, STYLE_SOLID);

     }

   else

     {

      Print("Error creating red horizontal line at price ", price);

     }

  }

Comments

Popular posts from this blog

MQL5 : Add time to current time in mins

MQL5: Closed order detail