Try it on my website!
Partly based on the explanation of algolines described here
- For each stock in my dataset, determine eligible starting points. Eligible starting points has:
- High Volume (Volume above 50 day MA)
- A wick (For a trendline connecting highs, the high should be reasonably far away from the body of the candle)
- No earnings on that day
- Get the gradient and intercept from each starting point to every high value after that point (For trendline connecting highs)
- For a 10-year dataset, one can see how this will take a long time to compute
- Hence i make use of numpy vectorised calculations whenever i can
- Check that between each start and end point, the trendline has not been breached (High price < trendline value for each day)
- For the trendlines that satisfy step 3, further extend the trendline to the latest date of my dataset. Check where the trendline gets breached, if at all (close price > trendline value).
- Calculate the number of touches this trendline has.
- Define a touch as high price being sufficiently close to the trendline (Does not need to be exactly touching)
- Get useful information of these trednlines, such as start date, breach date, gradient, intercept, trendline length, number of touches
- data_collection.ipynb pulls the required data from wrds and transform the data suitable for calculating trendlines.
- app.ipynb outlines the code which calculates the trendlines