How to draw a horizontal line across only 5, 8, or 13 bars?

Created at 21 Jan 2020, 03:58
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
FI

firemyst

Joined 26.03.2019

How to draw a horizontal line across only 5, 8, or 13 bars?
21 Jan 2020, 03:58


Hi everyone:

With the new API, Chart.DrawHorizontalLine doesn't seem to allow the drawing of horizontal lines that only span a fixed amount of candles or timeframe. Instead, it appears it only draws across the entire chart with absolutely no control over the length?

Is there a way to draw a horizontal line on a chart that only spans the last x candles?

Thank you.


@firemyst
Replies

PanagiotisCharalampous
21 Jan 2020, 08:59

Hi firemyst,

You can use Chart.DrawTrendLine() for this.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

firemyst
22 Jan 2020, 00:59

RE:

PanagiotisCharalampous said:

Hi firemyst,

You can use Chart.DrawTrendLine() for this.

Best Regards,

Panagiotis 

Join us on Telegram

Thanks @Panagiotis! That's what I needed. Only tricky part was remembering to set the 2 datetime parameters (x-axis) to the same value.


@firemyst