gaps history

Discussion in 'Automated Trading' started by Neutral, May 27, 2010.

  1. Neutral


    As part of filtering out "badly behaved" stocks from an automated strategy, I would like to find out the stocks that gapped down (on daily bars) by more than a given percentage over a period of time (how many times did XYZ gap down more than 1% over the last ten years,and by how much, that sort of thing). What is the best/fast way of going about doing that. I do have access to eSignal daily data, although never used their scripts. I also have access to thinkorswim, but again I have very limited experience of thinkscript. I can definitely code, but if there is an easy/fast way of doing it, I'd love to use it. Thanks for any help.
  2. promagma


  3. Bob111


    imo you going wrong be more accurate in your "filtering" you have to compare stock opening with something like SPY or some index or whatever.. what's wrong with stock open's with gap -2%, when SPY also open -2%?
  4. Neutral


  5. Neutral


    What's wrong or right depends on the strategy. If you are pairs-trading with SPY, there is nothing wrong with the gap down at all. However, that's not what I am considering right now. Of course I wouldn't be eliminating every stock that has ever gapped by more than the threshold. But some stocks gap down more than others, regardless of what the general market is doing. So repeat offenders or those gapping down monstrously would be good stocks to keep out. The method I am playing with right now doesn't care too much about the general market, as long as the the stops on individual stocks are not violated by too much too often. If the platform I am using for my backtesting were good enough, I wouldn't be asking this question; unfortunately it's not yet. It happily "executes" fictitious trades between the last close and the next open that gapped down beyond the stop. Sigh.
    Just trying to put the odds in my favor. Thanks.
  6. You actually want to count gaps. You can write simple code of the form (pseudocode)

    count = 0;
    while datafile
    if open of today < close of yesterday * 0.99 then

    That will give you the number of gaps > 1%. If you want not filled gaps you should make that

    if high of today < low of yesterday * 0.99 then

    or whatever definition of gap you like.

    You can add to it for more fancy stuff.
  7. Neutral


    Thanks for taking the time to reply. Yeah, I need to look into a platform that gives me more control, though. Maybe Tradelink.