Automatically Generating My Watchlist with the Trade-Ideas API

April 12th, 2007

I’m always looking for ways to cut down on the time I spend on my daily trading routine. Many of my various trading tasks are performed much better by a computer. In my experience, if there’s some task that you do that can be safely performed by a computer, then I believe it’s worth a one-time chunk of your time figuring out how to automate it. I’ve spent sometimes a few hours automating a task that only takes me a few seconds to do manually. There are many benefits to doing this:

  • Removes the chance for human error
  • Saves your time so you can do something more meaningful (this adds up over time)
  • Forces you to take a hard look at your task – often you’ll figure out a better way to do it
  • Sense of accomplishment

I’ve automated a few of my tasks, but most recently I’ve automated the creation of my morning gap list. Here’s the way I used to generate it:

  1. Use Trade-Ideas Pro to create 3 long alert windows and 3 short alert windows
  2. Bring up Trade-Ideas Pro just before the market open and just let it run
  3. At 10:00AM, export the history of each alert window to a csv file
  4. Run a script that knows the file names of my export files, reads them, and spits out a unique list of symbols
  5. Import them into CyberTrader

For many weeks I performed the steps above and thought it was pretty efficient. It worked well and trading life was good. But over time, as I did these steps over and over I realized there should be a way to automate the entire process. Sometimes I was distracted at 10AM and couldn’t perform the steps until a little later, putting me in “catch-up” mode when I did get around to it.

I sent David from Trade-Ideas a note asking if, perhaps, keyboard shortcuts could be added to Trade-Ideas Pro for the history export function in each window. He added it to the list of feature requests, but also pointed me to the Trade-Ideas API. After browsing the docs for a while, I realized it was possible to automate much of my 10AM routine.

I set out to create an app that uses the Trade-Ideas API to automatically generate my watchlist. I set a timer in the app which automatically creates a CyberTrader stocklist file that is easily imported into my trading platform. That timer fires first at 10AM. Every half hour for the rest of the trading day it fires again but creates a separate stocklist file that contains new symbols that have appeared since 10AM. This allows me to optionally look through an additional list during the day if there seems to be a relatively small number of stocks that initially fit my criteria after the 10AM run.

As I started coding the app, I realized this was also an opportunity to implement some features that Trade-Ideas Pro lacked that I thought would help me out. I created counters on each of the windows that show the number of alerts generated so far and a count of unique stocks that have produced those alerts. Also, I added some sound support for the alerts much like TI Pro, but with an important twist: the sounds only play when a symbol appears in the alert window for the first time. If you’re using the Percent Up Alert, for example, one stock could produce many of those alerts during the day – if it’s not something you’re going to trade do you want it playing a sound each time it comes up in an alert window? I didn’t. I want to be alerted only if there’s a new symbol in the window since it’s likely I’ve already looked at any symbol that’s appeared previously.

Here’s a screencast showing the app I created. Comments and suggestions welcome!


  1. estocastica Said,

    April 12, 2007 @ 9:35 am

    Nice work Dave! Would this also work with Interactive Brokers since it also has API capabilities?

  2. Todd Shriber Said,

    April 12, 2007 @ 11:20 am

    Thanks a lot, Dave. Great info here. – Todd Shriber

  3. Dave Said,

    April 12, 2007 @ 1:50 pm

    @David: Thanks! Uh-oh, maybe I didn’t realize what I was getting myself into. 😉

    @esto: Well, if IB can import a stock list, you could configure an app to create it in the right format that IB understands. The IB API wouldn’t necessarily need to be involved.

    @Todd: Thanks for stopping by and for the comments!

  4. Prospectus Said,

    April 13, 2007 @ 6:44 pm

    Awesome job. What did you code the App in? Is this something that you are willing to share with others?

  5. Dave Said,

    April 17, 2007 @ 5:26 am

    @Prospectus: I wrote it in C#. I’m thinking I might make it available somehow if there’s enough interest in it.

  6. jttrader Said,

    April 19, 2007 @ 5:55 pm

    That is great work. I have been meaning to look at the API, but I have been working on tradestation adaptive stops and didn’t get to it yet. Would you make the source available? I’m a developer too (I did the API and activex controls for other commercial products (Medical). How much time do you have in it? I’m only asking for my own use (as a start). I also want to collect the alerts on a single screen. Today I have them around a quote tracker window.


    – jttrader

RSS feed for comments on this post