Finding coordinates for a trendline

Created at 14 Mar 2019, 08:14
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!
IU

iulianalinchiru

Joined 28.03.2017

Finding coordinates for a trendline
14 Mar 2019, 08:14


Hi,

 

After drawing a trendline on chart, I can find the object with chartobject.findallobjects. But I can't find it's coordinates, starting point and final point (bar number and price value). I've tryed some functions but I'm not so good in programming... :(

Any idea how can I do this?

 

thx


@iulianalinchiru
Replies

PanagiotisCharalampous
14 Mar 2019, 09:47

Hi iulianalinchiru,

Trend line coordinates are kept in Time1, Time2 and Y1, Y2 properties. See here.

Best Regards,

Panagiotis


@PanagiotisCharalampous

iulianalinchiru
14 Mar 2019, 10:41

Yes, but I get only this options for the found objects

https://ctrader.com/api/reference/chartobject

I am doing something wrong... 


@iulianalinchiru

PanagiotisCharalampous
14 Mar 2019, 10:47

Hi iulianalinchiru,

You need to cast the object to a ChartTrendLine. See below

var trendline = (chartObject as ChartTrendLine);

Best Regards,

Panagiotis


@PanagiotisCharalampous

iulianalinchiru
14 Mar 2019, 10:48

Done while you writting. :)

Thx mate! Great support!


@iulianalinchiru