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?
How to draw vertical lines (time lines) [SOLVED]
- JoshM
- Posts: 2196
- Joined: May 20 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
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.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?
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.