Please Note: Blog posts are not selected, edited or screened by Seeking Alpha editors.

Is The Market Going To Go Up Or Down This Week?

|About: SPDR S&P 500 Trust ETF (SPY)
Summary

A system to place weekly trades on the S&P 500 is examined.

Boasts a win rate of 74% on the short side.

Even so, it may be best as an overlay rather than a stand alone strategy.

Borrowing from machine learning, some ideas for implementation are presented.

On Friday afternoon, traders are faced with how to reposition themselves for the week to come. As with much market analysis, there is a deluge of information that needs to be analyzed, including economic releases, geopolitical meetings and unfolding scandals.

Using a data driven approach, this article investigates a method of determining which weeks of the year that S&P 500 will be positive or negative based on their historical performance. Significant weeks are then identified as those weeks that have moved in a consistent direction in at least 17 of the prior 25 years, in other words, about two thirds of the time. For example, the 4th week of March posted a negative return 18 times from 1994-2018, making it a significant week. Therefore, this system called for a short trade in the S&P 500 at the close of the 3rd Fri of March, 3/16/18, to be covered on the 4th Fri of March, 3/23/18. Please note, since not all months have 5 Fridays, only weeks 1-4 of each month were used, leaving each year with a total of 48 weeks.

System Design

The following decisions were made:

  1. Start looking at data in 1988, after the 1987 crash.
  2. The last data point is the final Friday of 2018.
  3. Optimize over a period of 25 years.
  4. Transaction costs and slippage were ignored.
  5. Each trade assumed a position size of $10,000. In other words, the returns are not compounded.

Statistics

Earlier, it was mentioned that 17 weeks was chosen as the threshold for what makes a week trade-able. This warrants an explanation. Imagine flipping a coin 25 times. The odds of getting 17 or more heads is approximately 5%. Said another way, there is only a 5% chance of seeing 17 or more heads if you flip a coin 25 times. Therefore, if we observe this, we can be confident that it is not due to random chance.

Let’s expand this concept. There were 48 weeks examined in any given year. The fewest significant weeks over a 25 year period were found from 1988-2012, in which 10 were observed. The odds of finding 10 or more significant weeks by chance is 0.6%, so again, we can be confident that what we are observing is a market anomaly and not a random fluke.

Another more intuitive way to verify this is to run a simulation:

  • Perform 48 “coin-flips,” randomly selecting 1 or -1, thus creating 1 year of data.
  • Repeat this 25 times creating 1 set.
  • Perform the first two steps 10,000 times, creating 10,000 sets with each one consisting of 25 years of simulated weekly data.

The below histogram shows the total number of significant weeks observed in each of the 10,00 sets. For example, 1,718 sets had 4 significant weeks. You can see that very few had 10 or more significant weeks.

Coin Flip Simulation

Analysis and Methodology

S&P 500 price data was downloaded from Yahoo Finance and weekly returns from Friday to Friday were calculated using Python. Rather than optimizing over a single period and simply reporting those results, walk forward analysis was performed as follows:

  1. Optimize over a 25 year period, for example, 1988 – 2012
  2. Trade the following year, 2013
  3. Record the performance results for 2013
  4. Move the optimization window forward 1 year, to 1989-2013 and return to step 1.

This is in line with the machine learning principle of train and test data which reduces the risk of overfitting. This is hardly a new idea, but many papers and articles are still published which simply look at a block of time, optimize over that same period and report the results. This is not practical as we cannot trade on past data.

The disadvantage of walk forward analysis is a much shorter backtest. We only have results from 2013 – 2018. However, they are more robust.

Results

Equity Curve Looking at the Equity Curve, we can see that the backtest shows the strategy is positive on both the long and short side. However, the long trades have been flat to slightly negative since 2015. On the short side, there was one largely profitable trade in 2018. However, it interrupted a relatively smooth growth in profit so it is not a cause for concern. A table of all trades is available here.

For further analysis, let’s turn to a performance report:

All Trades

Longs

Shorts

Net Profit

$3,102

$1,587

$1,515

Gross Profit

$6,250

$4,414

$1,837

Gross Loss

($3,148)

($2,826)

($322)

Profit Factor

1.99

1.56

5.71

Total Trades

76

57

19

Win Percentage

66%

63%

74%

Biggest Win

$595

$341

$595

Worst Loss

($705)

($705)

($119)

Biggest Winner As Percent Of Gross Profit

10%

8%

32%

Worst Loss As Percent Of Gross Loss

22%

25%

37%

Pct Time In Market

5%

4%

1%

Sharpe

0.23

0.15

0.52

Sortino

0.25

0.16

1.67

Consecutive Wins

8

7

9

Consecutive Losses

3

4

3

Total Return

31.0%

15.9%

15.1%

Annualized Return

4.8%

2.6%

2.7%

Max Drawdown

5.4%

8.4%

1.1%

  • The first three rows show profit and loss figures on $10,000 initially invested. Since this strategy only has one open trade at a time, the same $10,000 was used on each trade. Net profit is Gross Profit + Gross Loss.
  • The Profit Factor is Gross Profit / Gross Loss * -1 and is a measure of reward vs risk. The short profit factor of 5.7 is attractive.
  • Unfortunately, we do not have a large sample size, only 19 trades on the short side. Ideally we would like a much larger sample size, but this is the data we have based on the initial system design. To combat this issue, we could start looking at data earlier than 1988 or use a window of less than 25 years.
  • The win percentage for each column is attractive. It’s psychologically easier for most of us to follow a system that wins more often than it loses.
  • Biggest Winner As Percent Of Gross Profit and Worst Loss As Percent Of Gross Loss look to identify outliers. On the short side, we can see that the 2018 trade mentioned above contributed to 32% of the short P&L. On the losing side, we observe that single trades contributed a significant part of the losses to each column.
  • This system doesn’t spend a lot of time in the market, an attractive feature.
  • The Sharpe ratios are nice but not great. The Sortino ratio on the short side is slightly better.
  • The return numbers are attractive when put into the context that the system was in cash most of the time.
  • While not noted in the performance report, it bears repeating that slippage and commission were not included, an issue that makes the performance look better than it would in reality.

Implementation

This strategy is probably not strong enough to be put into production as a stand-alone system. In machine learning terms, it can be thought of as a weak learner. Weak learners can be combined with other signals to form an ensemble, which can yield strong results. For instance, let us assume that the 3rd year of a first term presidency is a bullish year (proving this is the subject of another article). A trader could have traded only the long side of the study presented here in 2019 and they would have done quite well so far.

The main reason transaction costs were ignored is that there are multiple instruments that can be used to place this trade, for instance, the SPY, S&P 500 futures or a myriad of options strategies. This is entirely up to the trader and each has its own pros and cons. If using an ETF, be mindful of dividends which this study did not include. In theory, they would provide tailwind for long positions and should be avoided for shorts. ETF behavior after going ex-dividend could be a subject for a different study that could then be overlaid with the one presented here.

Further Study

There are a few ways this system can be further researched. First, there is a disconnect between the investigation of up week vs down week and implementation via a long or short position. It is certainly possible for a system to win more often than it loses but still lose overall if the losing trades are disproportionally larger than the winners. One way to remedy this is to implement the strategy using binary options, that payoff regardless of the magnitude of the move. If the underlying is up 0.1% or 5%, it doesn’t matter, the payout is the same.

Second, this study assumes that a week has 50/50 odds of being up or down. In reality, the S&P 500 has an upward bias. This can be calculated and used to come up with different thresholds for long and short trades. We would expect fewer longs, since they have a higher hurdle to overcome, maybe around 19, and more shorts, since they now have a lower hurdle, perhaps around 14.

Third, a 25 year look back is not a magic number; a different size window could be used. As mentioned earlier, a shorter period would result in more results for the backtest. Furthermore, it would be more flexible to account for changes in market structure.

Fourth, only the S&P 500 was examined. Repeating this on correlated equity indices could shine more light onto the effectiveness of the strategy and yield more opportunity. Of course, it can also be run on commodities, currencies or bonds.

Last, and most important, is understanding why this is occurring. For example, the 4th week of March, June and September have shown up as down weeks in each of the years in the backtest. Is it because they are the weeks following quadruple witching? Could there be a rebalancing or rollover effect that is putting pressure on S&P 500 performance of those weeks? It so, why isn’t the 4th week of December also included?

Conclusion

A system to make traders more comfortable going into the weekend was examined. Rather than examine one time period in its entirety, a walk forward analysis was done to make the results more robust and less subject to curve fitting. On its own, the system may not be strong enough, but it can function as a seasonal overlay onto other trading methods.

Disclosure: I/we have no positions in any stocks mentioned, and no plans to initiate any positions within the next 72 hours.

I wrote this article myself, and it expresses my own opinions. I am not receiving compensation for it (other than from Seeking Alpha). I have no business relationship with any company whose stock is mentioned in this article.