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.
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.
What would be the best way to go about solving this problem?
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.