pythonpandasstockquoteszipline

How to Code Trendline Angle


I want to connect the ''Highs'' of the bars as shown in the image. 'A' point (the 'high' of a candle / bar) is to be connected to the 'B' point.( the condition for 'B' point is that it should be any bar below -20 degree and distance between these two shall not be less than 10 bars). Also, i need to keep track of the future data(Realtime Quotes) 'C' at the same angle which 'A' and B is having. I had a hard time finding a way to code the angle direction for a pandas dataframe which is stock price data. How to code such angles? and how to keep track of data at such angle like 'C' as shown in the image without having the data after the 'B' point?(that is, Realtime Quotes) Stock Price data with trendline


Solution

  • Instead of using Trendline Angle for your Model, Consider using Percent Change. As it can be be easy to deal with, as compared to angle which makes you exposed to trigonometry.

    Using Percent change from the point 1 to point 2 is almost similar to calculating Angle from point 1 to point 2. I would recommend using Percent change as a way to go for such Requirements.