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.

  1. 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;

  2. 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)



It's a momentum strategy. I would implement it as a staged pipeline:

  1. Initialize an instrument watch list prior to trading session. It can be a black/white list based on risk parameters and/or reference data. For example, only US common stocks (no ADRs, ETFs, etc.) with a market cap of over $1B.

  2. Load all-time-high (ATH) prices and ATH dates for the instruments in the watch list. This step is needed mostly for performance so that the system doesn't fetch historical data on each incoming trade. As part of this step, discard instrument with a recent ATH, e.g. ATH >= today - 1*day.

  3. Process incoming trades ingested from the real-time feed, compare last trade with preloaded ATH for the short-listed instruments. Initiate a response, such as a notification, whenever the level is breached. Such notification can accompanied with an OHLCV chart and/or OHLCV table for expert analysis. Alternatively, to prevent too many alert, trigger a scheduled notification, for example once an hour, by sending out a list of instruments that breached the level over the last hour.

Update: I setup a public Telegram channel with all-time-high alerts for 1200+ A, B and C symbols which are matched with SQL expression symbol REGEX 'A.*|B.*|C.*' on an incoming stream of round-lot trades. Each alert contains brief a price summary, a link to a Bloomberg chart such as https://www.bloomberg.com/quote/CVNA:US and a 30-day candlestick chart image.

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.