Download MetaTrader 5
To add comments, please log in or register
Looking for like-minded people? You will find lots of them on the Forum!
Miroslav Popov
327
Miroslav Popov 2016.06.14 09:32 

Hello,

 

How can we draw a dashed, colored line from a (Price 1, Time 1) point  to another   (Price 2, Time 2) point?

 

Something like the blue dashed lines on this screenshot:

 

 

Keith Watford
Moderator
7906
Keith Watford 2016.06.14 10:31  
Use a trendline and set the style to dash
Miroslav Popov
327
Miroslav Popov 2016.06.14 12:15  

Thank you. It works like a charm!

 

 

 

void CreatePositionLine(datetime time1, double price1, datetime time2, double price2, int lineColor) 
{
  string name = "Position line " + TimeToString(time1);
  if (!ObjectCreate(0, name, OBJ_TREND, 0, time1, price1, time2, price2))
      return;
   ObjectSetInteger(0, name, OBJPROP_COLOR, lineColor);
   ObjectSetInteger(0, name, OBJPROP_STYLE, STYLE_DOT);
   ObjectSetInteger(0, name, OBJPROP_WIDTH, 1);
   ObjectSetInteger(0, name, OBJPROP_BACK, false);
   ObjectSetInteger(0, name, OBJPROP_SELECTABLE,false);
   ObjectSetInteger(0, name, OBJPROP_SELECTED, false);
   ObjectSetInteger(0, name, OBJPROP_RAY_RIGHT, false);
   ObjectSetInteger(0, name, OBJPROP_HIDDEN, true);
   ObjectSetInteger(0, name, OBJPROP_ZORDER, 0);
}
/
To add comments, please log in or register