# Calculating the angle of three values of stochastic

68

Hi

I'm trying to retrieve the last 3 values of stochastic main,  and calculate the angle of these three values/lines

Is there a way to do this?  I have no issue calling the values out, just can't figure out how to get the angle of these 2 lines (that connects these three Dots)

Thanks!

17097

Can't be done.
1. There is no angle from 2 anchor points. An angle requires distance/distance a unitless number. A chart has price/time. What is the angle of going 30 miles in 45 minutes? Meaningless!
2. You can get the slope from a trendline. Delta price / delta time. Changing the axes scales changes the apparent angle, the slope is constant. Angle is meaningless.
3. You can create a angled line using one point and setting the angle. The line is drawn that angle in pixels. Changing the axes scales does NOT change the angle.
68

whroeder1:
Can't be done.
1. There is no angle from 2 anchor points. An angle requires distance/distance a unitless number. A chart has price/time. What is the angle of going 30 miles in 45 minutes? Meaningless!
2. You can get the slope from a trendline. Delta price / delta time. Changing the axes scales changes the apparent angle, the slope is constant. Angle is meaningless.
3. You can create a angled line using one point and setting the angle. The line is drawn that angle in pixels. Changing the axes scales does NOT change the angle.

Just wanted to double confirm that we are on the same page, attached is a screenshot.

Ignore the red signal line for the stochastic.

In this example, the angle for the MAIN line is around 90 degrees. I would like to see if we can use maths calculation to get this degree.

Otherwise, would Slope be possible in this case?

Thanks!

Files:
70978

mingteikg:

Just wanted to double confirm that we are on the same page, attached is a screenshot.

Ignore the red signal line for the stochastic.

In this example, the angle for the MAIN line is around 90 degrees. I would like to see if we can use maths calculation to get this degree.

Otherwise, would Slope be possible in this case?

Thanks!

There is no angle in time series

Slope = Current value - Previous value

Moderator
7958

What a bout google for: "angle of two slopes"?
17097

Carl Schreiber: What a bout google for: "angle of two slopes"?

Good point. Generate the one slope. Compute the angle between it an a horizontal line (zero slope.)

Not compiled, not tested.

```// Angle (in degrees) Between Two Lines http://www.tpub.com/math2/5.htm
double angle(double vCurr1,   double v1Prev,   uint nBars1=1,
double vCurr2=0, double v2Prev=0, uint nBars2=1){
double   slope1   = (vCurr1 - v1Prev) / nBars1;
double   slope2   = (vCurr2 - v2Prev) / nBars2;
if(slope1 * slope2 == 1)   return 90.0;
arcTan( (slope2 - slope1) / (1 - slope1*slope2) );
}
double arcTan(double v){ return MathArctan(v) * 360/M_PI_2; }
```
Not compiled, not tested.
1537

whroeder1:

Good point. Generate the one slope. Compute the angle between it an a horizontal line (zero slope.)

Not compiled, not tested.

Not compiled, not tested.