Ray Tool

Created at 16 May 2013, 14: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!
lec0456's avatar

lec0456

Joined 14.11.2012

Ray Tool
16 May 2013, 14:33


When using the ray tool, what is the formula you are using to calculate the angle?


@lec0456
Replies

cAlgo_Fanatic
21 May 2013, 17:31

var angle = (int) (Math.Atan2(-deltaY, deltaX) * 180 / Math.PI);

It's calculated in pixels in current chart scale. If you want to do it in cAlgo API, it's impossible because we do not operate with pixels there.

 


@cAlgo_Fanatic

lec0456
22 May 2013, 00:37

Hmm, my question is if I use price as deltaY and time period as deltaX would I be calculating the correct angle using that formula?


@lec0456

cAlgo_Fanatic
22 May 2013, 15:05

No. (-deltaY, deltaX) are window coordinates. If you set the ray and then modify the chart scale alone the angle value will change.


@cAlgo_Fanatic