ChartTrendLine getting angle

Created at 28 Oct 2024, 04:08
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!
JS

jstewartcenter

Joined 18.11.2023

ChartTrendLine getting angle
28 Oct 2024, 04:08


Would it be possible for us to get the algo of how the ChartTrendLine calculates the angle it shows. I can set ShowAngle to true and it gives me the exact angle I want, but for the life of me I cant seem to create code that will produce the same results. I would rather not have to draw a trendline and then remove it and even if I could do that, the angle is not a property that is exposed. Any help with this would be wonderful. Thank you!


@jstewartcenter
Replies

PanagiotisCharalampous
29 Oct 2024, 06:49

Hi there,

There is no way get this information via the API. The angle is calculated based on the screen's pixels

Best regards,

Panagiotis


@PanagiotisCharalampous

firemyst
29 Oct 2024, 06:55

Keep in mind that regardless of how Spotware/cTrader calculate the angle, the angle will vary depending on the chart's zoom level horizontally / vertically. 

It will also change as more bars appear to the right or if you scroll the chart back to the left as cTrader automatically scales the chart.

 


@firemyst

jstewartcenter
29 Oct 2024, 22:29

RE: ChartTrendLine getting angle

PanagiotisCharalampous said: 

Hi there,

There is no way get this information via the API. The angle is calculated based on the screen's pixels

Best regards,

Panagiotis

Thank you. This is very helpful.


@jstewartcenter