Calculate the angle of $\theta$ in pythagoreans theorem with different units for the Adjacent and Opposite sides

88 Views Asked by At

enter image description here

In the above image I know the value of the adjacent side. It's $298$. I know the value of the opposite side it's $806.8$. The problem is $298$ is in units of 'bars' on a stock chart and the value of $806.8$ is representing the price difference. We can't mix different units and get a meaningful answer with the standard Pythagorean theorem. My goal is to calculate what the angle $\theta$ is in the image above.

For example on the site tradingview.com, I drew this image.

enter image description here

Notice it says the angle is $-15$ degrees. It's able to calculate that because it can assume it's a right triangle (you can kind of see it with the dashed lines acting as the other side of the right triangle). The $-806.8$ is representing degree's of difference downwards; So that would be the opposite side in my diagram. The $298$ bars would be the adjacent side.

This is exactly what I'm trying to do. I uploaded the image I used above and just inversed it to further clarify. The words are just messed up. This matches the same orientation as the tradingview line image.

enter image description here

What would be the best way to go about solving this problem?

Acceptable Answers:

I am writing a computer program to help solve this, therefore any solution that requires multiple 'testing' is OK. I can just run a loop to try different values until we get something that works.

Converting the price and time into some combined unit is OK, all we ultimately care about is the angle

I could program something where the user plugs in different values until the angle 'looks' like a $45$ degree angle to get the ratios right.

So this should give a lot of creative possibilities to discover an answer and I'm not sure the best route to go. I have looked around and found no solutions for this kind of problem.

1

There are 1 best solutions below

15
On BEST ANSWER

There is no natural metric (no sense of length or angle) on a graph with different units. You can stretch the graph horizontally or vertically and change the apparent angle.

So just pick any numbers $a,b>0$ (with appropriate units) and say that the hypotenuse is

$$\sqrt{a*(\text{adjacent})^2+b*(\text{opposite})^2}$$

and the angle is

$$\arccos\frac{\sqrt a*(\text{adjacent})}{\sqrt{a*(\text{adjacent})^2+b*(\text{opposite})^2}}=\arctan\frac{\sqrt b*(\text{opposite})}{\sqrt a *(\text{adjacent})}.$$

See inner product and metric tensor.