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

Questions about MultiCharts .NET and user contributed studies.
jarym
Posts: 58
Joined: 16 Feb 2015
Has thanked: 14 times
Been thanked: 6 times

How to draw vertical lines (time lines)

Postby jarym » 19 Apr 2015

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?

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

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

Postby JoshM » 20 Apr 2015

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.

jarym
Posts: 58
Joined: 16 Feb 2015
Has thanked: 14 times
Been thanked: 6 times

Re: How to draw vertical lines (time lines)

Postby jarym » 20 Apr 2015

Thanks! I'll try it


Return to “MultiCharts .NET”