Download MetaTrader 5

How can I get the candle number on which the vertical line is drawn?

To add comments, please log in or register
Pipsik
15
Pipsik  
How can I get the candle number on which the vertical line is drawn? Sorry for my English.
honest_knave
Moderator
2293
honest_knave  
Pipsik:
How can I get the candle number on which the vertical line is drawn? Sorry for my English.
   datetime when = (datetime)ObjectGetInteger(0, "MyVerticalLine", OBJPROP_TIME, 0);
   int shift = iBarShift(_Symbol, PERIOD_CURRENT, when);
   Print("Vertical line is drawn on candle ", shift);

Be careful if the object doesn't exist. If the object doesn't exist, when == 0 so iBarShift will be the oldest bar on the chart (depending on what you set for 'exact' in iBarShift)

Pipsik
15
Pipsik  
Thanks.
To add comments, please log in or register