Most gains for $SPY happen overnight: a quantitative study

According to the New York Times 2018: most gains for SPY happen overnight. "If you had bought the SPY at the last second of trading on each business day since 1993 and sold at the market open the next day — capturing all of the net after-hour gains — your cumulative price gain would be 571 percent."

We thought why not to review this thesis in a bit more detailed way. We set a simple backtest that is not going back to 1993 but to Jan 1, 2010: hold overnight and sell in the morning.

The Setup

  • $10,000 to trade daily (nightly actually)
  • Trading only SPY
  • Buy at 3:59 using a market order
  • Sell at 9:30, 9:31, 9:32, 9:33, 9:34, 9:35 (let's see which one does better) using a market order
  • Do not trade on early close days


Algo Parameters

Enter Criteria:
1.#No condition - just enter a position
2.True

Exit Criteria:
1.#Exit next day, when there is a position
2.Position.size>0

The Results

Strategy: Hold overnight, exit 9:30
Total wins: 1651
Total loses: 1359
Total gain: 79.54%
Total gain 2022: -2.59%

Strategy: Hold overnight, exit 9:31
Total wins: 1629
Total loses: 1341
Total gain: 80.04%
Total gain 2022: -2.88%

Strategy: Hold overnight, exit 9:32
Total wins: 1628
Total loses: 1342
Total gain: 88.80%
Total gain 2022: -3.31%

Strategy: Hold overnight, exit 9:33
Total wins: 1618
Total loses: 1352
Total gain: 94.28%
Total gain 2022: -3.96%

Strategy: Hold overnight, exit 9:34
Total wins: 1617
Total loses: 1353
Total gain: 94.11%
Total gain 2022: -3.63%

Strategy: Hold overnight, exit 9:35
Total wins: 1633
Total loses: 1337
Total gain: 90.48%
Total gain 2022: -4.36%

Disclaimer: This post is for fun and educational purposes only with no attempt to beat buy and hold. Do not use this as trading/investment advice.
algoalgotradingBeyond Technical AnalysisTrend Analysis

Disclaimer