Page 1 of 1

How to draw vertical lines (time lines)

Posted: Apr 19 2015
by jarym
Hi, when drawing on a chart there is the ability to draw a vertical line (listed in the drawing pallet as a 'Time line').

Is there an API that programmatically allows us to draw these vertical lines as part of indicator code?

Re: How to draw vertical lines (time lines)  [SOLVED]

Posted: Apr 20 2015
by JoshM
Hi, when drawing on a chart there is the ability to draw a vertical line (listed in the drawing pallet as a 'Time line').

Is there an API that programmatically allows us to draw these vertical lines as part of indicator code?
You can approach the behaviour of 'Time line', but I don't know how to add the vertically displayed text that shows the time of the vertical line.

But to draw a vertical line:
- Create two `ChartPoint` struct variables, both set to the same`DateTime` (like `Bars.Time[0]`) but with a different price.
- Draw a trend line between both chart locations with `DrwTrendLine.Create()` and store the reference returned by this method in an `ITrendLineObject` variable.
- Use that variable to set the line's `ExtRight` and `ExtLeft` properties to true. That way the small vertical line on the bar (from step 2) is extended to the top and bottom to create a vertical line.

Re: How to draw vertical lines (time lines)

Posted: Apr 20 2015
by jarym
Thanks! I'll try it