Gap Fill Trading Strategies – Opening Gaps in The SPY and S&P 500 | Gap Trading Systems [Backtest]

Last Updated on June 30, 2022 by Oddmund Groette

Searching on the internet you can find a lot of articles on how to play the opening gap of the S&P 500. Gap trading strategies are popular.

What is an opening gap? (Gap Fill)

A gap is when the opening price (or print) is higher or lower than the previous close. A gap up indicates the opening is higher than the previous close and vice versa.

Other traders might define gaps more stringent: a gap up is when the opening is higher than yesterday’s high, and a gap down when the opening is lower than yesterday’s low.

Gap Fill

Types of gaps and gap fill

There are many types of gaps, however, the three most common are runaway gaps (breakaway gaps), exhaustion gaps, and common gaps.

Common gaps

As the name implies, these are gaps that are “common” and frequent. For example, the S&P 500 opens up or down more or less every day. Most of the days this is just noise and hardly worth to write about (in the news). Typically, the gaps are in the range of plus/minus 0.25%.

Runaway gaps

This gap is often called breakaway gaps. This gap usually leads to higher or lower prices in the same direction of the gap. If it gaps up, we can expect higher prices in the future.

However, it’s easy to explain with hindsight.

Exhaustion gaps

Exhaustion gaps happen after an already extended move in one direction.

For example, if the S&P has had a sudden move over several days upwards, we have a potential exhaustion gap if it one day gaps up more than normal (average).

An exhaustion gap signals the end of the move: it’s the climax.

Do gaps get filled?

It depends on the size of the gap and time. Most small gaps are filled the very same day, while bigger gaps need more time (days) to get filled. You can read more about gaps in this article. We have previously also written about unfilled gap.

Some gaps need many many days to fill, some even months, and some never (applies more to single stocks – not indices).

Can you predict a gap opening?

The activity in the market before the official opening is easy to spot. All liquid ETFs and futures contracts indicate where it’s gonna open, of course, it might vary from minute to minute.

You can also use statistics to indicate the probability of a gap up or down opening the next day based on statistics.

Opening gap strategy in the S&P 500 (SPY Gap Fill)

Today I did my personal twist on this strategy. Over the last two months, I’ve been trading a similar strategy, but not exactly the same as the one I’ve tested here.

Here are the details (for long):

  1. If SPY gaps down lower than -0.15% but higher than -0.6%, go long at the opening print/cross. The reason I use -0.6% as the maximum is that SPY shows a lot less mean reversion if opening lower. To me that makes sense. Usually, there is not that much “news” if SPY opens for example -0.4% down compared to for example 1%. However, if SPY opens more than 1% down it’s a good short, vice versa for long if it opens above 1%.
  2. Target is 0.75 of the gap. If it opens down -0.5%, the target is 0.375% higher than the fill price. If the target is not reached exit is at the close. No other stops.
  3. Yesterday’s close must be lower than 0.25 of this formula: (close-low)/(high-low). The reason I use this is because of SPY’s mean-reversion tendencies. It means fewer fills, but a higher average per fill. The tighter I set these criteria, the better average per fill (but obviously less fills).

The test period is from 1. January 2010 until August 2012. In total there are 110 fills and 98 winners. The average per fill is a respectable 0.19%. Here is the equity curve:

SPY Gap Fill

Here is the distribution:

Small winners and occasionally a big loser.

The data is adjusted for dividends and collected from Yahoo! and IQFeed. I have tested on both data sets with not much difference. I have used EOD quotes, ie. only open, high, low and close.

I wrote this article on the 20th of September 2012. A perfect day for this strategy. SPY opened down about 0.47% and filled the gap all the way up until yesterday’s close.

The strategy seems very robust and yields very good numbers.  Perhaps too good to be true? Yes, it’s probably too good to be true. The reason is that some of the high and low quotes are wrong which boosts the numbers. That’s why I’ll write a second article on this strategy and test it on intraday data from IQFeed. Then we’ll find out if there is a discrepancy in the data sets (which I believe it is).

Any thoughts about this strategy? I know this strategy didn’t perform very well some years ago. However, markets always change and we have to adjust. You won’t find a strategy that lasts year after year.

 

The opening gap strategy above showed promising returns. However, can we trust the data? The test was performed on EOD data from Yahoo! (open, high, low, and close per day).

Today I have downloaded 30 mins data from IQFeed. The test period is the same: 1. January 2010 until 1st of July 2012. All the other parameters are the same. The result is still quite good:

In total there are 89 fills, 21 less than on the EOD test.  The average gain for long is 0.22% and 0.08% for short.

I have no idea why the numbers are so different. This proves that backtesting is just an indication, you need to test live to get a grasp of the strategy.

—————–

 

I decided to look more into opening gaps in SPY (S&P 500) to look for fade the gap strategies. After all, a lot of traders claim to make good money on this strategy, at least according to my search on the web.

For me, this is unknown territory as up until this date I have only been day trading stocks, and my experience in trading indices is close to zero.

My database in this sample is from January 2005 until October 2012. I’m using EOD data on SPY downloaded from Yahoo! Finance. This means I only check the SPY’s Open, High, Low and Close for the day. There is no intraday data. I suspect the results are a good deal better than to expect in live trading, keep that in mind.

In my first post about opening gaps, I faded (going against the gap) gaps under 0.6%. In my findings below I’m fading every gap between 0.1% to 0.6% (and vice versa). Target is 75% of the gap size from the close.

Day of week

Mondays:

Total in % #fills #wins Avg
12.05 200 160 0.060

Tuesdays:

Total in % #fills #wins Avg
11.76 231 182 0.051

Wednesdays:

Total in % #fills #wins Avg
22.68 239 202 0.095

Thursdays:

Total in % #fills #wins Avg
18.94 213 181 0.089

Fridays:

Total in % #fills #wins Avg
17.99 210 172 0.086

The equity curve looks the best on Fridays, a lot steadier on that day. The later in the week, the better. I don’t know why. But it opens opportunities to trade other twists earlier in the week.

Period of month

Day 1 to (and including) 10:

Total in % #fills #wins Avg
22.05 349 277 0.063

Day 11 to 20:

Total in % #fills #wins Avg
27.11 366 303 0.074

Day 21 to 31:

Total in % #fills #wins Avg
34.27 378 317 0.091

Worth noting is that the 1st day of the month is horrible. The last two days of the month are very good.

Gaps inside yesterday’s bar

When SPY either opens below yesterday’s high or above yesterday’s low:

Total in % #fills #wins Avg
43.56 734 610 0.059

Gaps outside yesterday’s bar

When SPY opens above yesterday’s high or below yesterday’s low:

Total in % #fills #wins Avg
39.88 359 287 0.111

The equity curve looks a lot better for gaps outside yesterday’s bar than those gaps inside. The average is also a lot better.

Gaps outside 3 days range

Gap up must open higher than the high of the previous 3 days and vice versa for longs.

Total in % #fills #wins Avg % long % short #fills long #fills short
24.14 197 158 0.123 6.65 17.50 56 141

This equity curve looks really nice! These days we can even trade gaps up until 0.75% with very good results.

Yesterday unfilled gap down

If yesterday gapped down (when high of yesterday is lower than low two days ago):

Total in % #fills #wins Avg % long % short #fills long #fills short
5.21 33 30 0.158 3.21 2.00 12 21

Very good results, but not surprisingly it’s long which is best. All longs hit the target. A good example of reverting to the mean.

Yesterday unfilled gap up

Total in % #fills #wins Avg % long % short #fills long #fills short
8.97 66 58 0.136 6.48 2.49 34 32

If it’s a gap up the day before, both directions are good. In general, if unfilled gap yesterday, the better chances to fade the gap.

Gaps after a high range day

What happens if yesterday had a higher range (HIGH-LOW) than the 15 days average?

Total in % #fills #wins Avg % long % short #fills long #fills short
34.30 439 363 0.078 19.57 14.73 168 271

Gaps after a low range day

Total in % #fills #wins Avg % long % short #fills long #fills short
48.86 640 527 0.076 18.52 30.34 297 343

Gaps when yesterdays close was above 10 day moving average

Total in % #fills #wins Avg % long % short #fills long #fills short
56.94 682 561 0.083 23.85 33.09 326 356

Gaps when yesterdays close was lower than 10 day moving average

Total in % #fills #wins Avg % long % short #fills long #fills short
26.32 404 332 0.065 14.24 12.08 141 263

Gaps when yesterdays close was at least 2% above 10 day moving average

Total in % #fills #wins Avg % long % short #fills long #fills short
11.23 94 84 0.120 6.87 4.36 59 35

Gaps when yesterdays close was at least 2% below 10 day moving average

Total in % #fills #wins Avg % long % short #fills long #fills short
15.89 86 82 0.185 9.14 6.75 34 52

Gaps when the close is above 0.5 in yesterday’s range

Here I’m using the formula (CLOSE-LOW)/(HIGH-LOW) to decide yesterday’s range:

Total in % #fills #wins Avg % long % short #fills long #fills short
34.98 612 485 0.057 12.90 22.08 280 332

Gaps when the close is below 0.5 in today’s range

Total in % #fills #wins Avg % long % short #fills long #fills short
47.98 479 410 0.100 25.06 22.92 189 290

Gaps when the close is above 0.75 in yesterday’s range

Total in % #fills #wins Avg % long % short #fills long #fills short
27.67 359 299 0.077 11.21 16.47 167 192

Gaps when the close is below 0.25 in today’s range

Total in % #fills #wins Avg % long % short #fills long #fills short
32.76 264 229 0.124 14.77 17.99 98 166

Why is gaps much better when yesterday’s close is lower than 0.25? Both long and short are better with a nice and steady upward sloping equity curve.

Gaps when yesterday’s open is lower than yesterday’s close

Total in % #fills #wins Avg % long % short #fills long #fills short
39.44 556 451 0.071 17.55 21.89 261 295

Gaps when yesterday’s open is higher than yesterday’s close

Total in % #fills #wins Avg % long % short #fills long #fills short
43.71 528 439 0.083 19.57 24.14 203 325

Yesterday gapped down and closed below 0.33 on the daily range

Total in % #fills #wins Avg % long % short #fills long #fills short
10.30 160 134 0.064 4.39 5.91 62 98

Yesterday gapped up and closed above 0.66 on the daily range

Total in % #fills #wins Avg % long % short #fills long #fills short
17.20 262 217 0.066 11.01 6.19 132 130

Gaps on the day of the monthly jobs report

This is the most important macroeconomic news in the month and might be worth considering. It’s on the first Friday of the month. Friday is the best gap day of the week. Here is the result on those days:

Total in % #fills #wins Avg % long % short #fills long #fills short
3.40 44 36 0.077 2.20 1.20 13 31

The win rate is pretty good, but the average is below other Fridays. So this is perhaps worth mentioning.

Developing a fade the gap strategy is not easy, but hopefully, the numbers provided in this article help you get started. Gap trading strategies have been around for a long time, but the window of opportunity is getting smaller with the increased computer power that arbs away the anomalies.

——–

If you would like to have the code for this strategy plus 70+ other free trading strategies published on this website, please click on this link:

For more trading strategies, please click here:

Similar Posts

  • A year or two ago there was a couple professors from Texas who did some work on price gaps. Not “opening” gaps, but where an entire day of trading formed a gap. I’ll see if I can dig up the information.

  • Actually, this was quite interesting. I’ll try to do some research on this as well. I’ll get back with the results!

  • Did you find that the high/low was incorrect for Yahoo! financial data for the SPY? I expected it is fairly accurate and tradable since the SPY doesn’t have random quote spikes like some small stocks do.

    When I played around with this, I found that you can change the size of the target and the results don’t drastically change. The downside is that you trade twice almost everday and it doesn’t work very well for any other ETFs except for QQQ. Also the average gain is fairly small.

      • Unfortunately there is several bad quotes in SPY. Let’s take 30th of November 2011 as one example: opened up and has a very long tail down. This is incorrect. I rememeber this day very well because of this. I know there are more of this.

        I will publish another test in some days using intraday data. I went briefly through some ES data, and they were not nearly as good.

      • Yes, I know this article. I believe it changed due to algo trading. The markets have changed a lot over the last two years. Also, I think the opening price in many cases is wrong…. Sadly, my experience tells me that backtesting yields far better results than can be expected in real life.

        • Yeah, I agree. The more and more I read about this subject, the more I find that trading is such a scam at the retail level. There is no way someone with an account less than one million can realistically generate enough returns to live off it. You need to devote so much resources into just have things like accurate data and proper infrastructure.

          The only people I really know or read about that were successful basically would manage other people’s money so they get couple of percent off of billions of dollars and no downside if it blows up (to them 10% is usually a good year) or they are market makers who are generally profitable every month (again usually with other people’s money).

          I think people are just drawn to trading because you get to work for yourself and people think trader = wall street banker. In reality retailers are just giving their money away through commissions and spreads.