find distance between current price and horizontal line programmatically

Created at 29 Oct 2018, 17:33
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!
alexander.n.fedorov's avatar

alexander.n.fedorov

Joined 02.01.2018

find distance between current price and horizontal line programmatically
29 Oct 2018, 17:33


Dear Panagiotis, hi!

How do you find distance  between current price and horizontal line on a chart programmatically?

 

regards, 

 

Alexander


@alexander.n.fedorov
Replies

PanagiotisCharalampous
29 Oct 2018, 17:50

Hi Sasha,

See below

            foreach (var obj in Chart.Objects)
            {
                if (obj is ChartHorizontalLine)
                {
                    var line = (ChartHorizontalLine)obj;
                    Print(line.Y);
                }
            }

Best Regards,

Panagiotis


@PanagiotisCharalampous

alexander.n.fedorov
30 Oct 2018, 10:51 ( Updated at: 21 Dec 2023, 09:20 )

Maybe it has smth to do with versions?


@alexander.n.fedorov

PanagiotisCharalampous
30 Oct 2018, 10:55

Yes, this works only for version 3.3


@PanagiotisCharalampous

alexander.n.fedorov
30 Oct 2018, 11:06

Dear Panagiotis,

is there any way to do that with other versions?

 

Regards, 

Sasha


@alexander.n.fedorov