I am trying to automate the trading strategy that I have been previously executing manually. I am having problems with figuring out the most efficient way for a specific step of the strategy.
An essential part of the strategy is identifying stocks that have made a new year-to-date all-time high. Additionally to that, the new all-time high should not be recent to the previous day levels. (E.g. Stock making all-time high values each subsequent trading day). Currently, I have figured out two different approaches with resources that are available to my best knowledge.
After I get a signal for ATH from a data vendor, I request data for all candles for all available time period, sort them and check if the and date of the second-highest value fits my criteria;
Create a database on my own for previous ATH values of lots of equities and screen prices against the database values. (seems really inefficient approach)
If you know any better approach or know a data vendor that could provide with the aforementioned data directly I would much appreciate it. Paid data is also an option as long as the price is not astronomical (Keep in mind that I am a retail trader and can not affor to pay 40k yearly for a datastream)
Cheers