How to Draw line from Price1 / Time1 to Price2 / Time2 ?

Back to topics list To post a new topic, please log in or register
avatar
115
Miroslav_Popov 2016.06.14 11: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:

 

 

avatar
Moderator
3427
GumRai 2016.06.14 12:31 #
 
Use a trendline and set the style to dash
avatar
115
Miroslav_Popov 2016.06.14 14: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);
}

 

 

Back to topics list  

To add comments, please log in or register