Download MetaTrader 5

Calculating the angle of three values of stochastic

To add comments, please log in or register
mingteikg
68
mingteikg  

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! 

whroeder1
17097
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.
mingteikg
68
mingteikg  
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.

Thanks, appreciate your response.


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:
Mladen Rakic
70978
Mladen Rakic  
mingteikg:

Thanks, appreciate your response.


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

Carl Schreiber
Moderator
7958
Carl Schreiber  
What a bout google for: "angle of two slopes"?
whroeder1
17097
whroeder1  
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.
nicholishen
1537
nicholishen  
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.
I agree with your original comments... How it's angle relevant?
whroeder1
17097
whroeder1  
nicholishen: I agree with your original comments... How it's angle relevant?
I shouldn't have jumped in before the coffee started working. Changing any one of the three scales (TF/Bar width/Price scale) changes the apparent angle and is therefor useless.
Alain Verleyen
Moderator
29859
Alain Verleyen  
whroeder1:
I shouldn't have jumped in before the coffee started working. Changing any one of the three scales (TF/Bar width/Price scale) changes the apparent angle and is therefor useless.
It also changes with screen settings, window size...and maybe more, still people want to work with angles.
To add comments, please log in or register