Monday, February 28, 2011

Gaps, part 3

Recently I've come to realise that I've made quite a mistake calculating the 'fill' ratio for the gaps. It's time to correct it, before somebody will embarrass me in the comments ;-).The problem is that I've used asymmetric boundaries when calculating the  statistics. By doing this, the statistics shift in favor of the nearest stop. The closer the stop, the higher the chances of hitting it, but by no means does this mean profit. And previous close is usually not far from the open so chances of hitting it are quite high.
To make statistics fair, I've set the levels symmetric around the open, like this:
gap = open-prevClose
winLevel = open+gap
lossLevel = open-gap

With this calculation* the chances are quite different and closer to my results using the intraday data:
down gap: 52% fill
up gap: 48% fill

*geek note: when both win and loss levels are reached for the same day, it is counted both as win and loss (with daily ohlc data there is no way of knowing which one was reached first) . Data for SPY Feb.2000- Feb-2011.

Code: dumbGaps.m