Skip to main content

A simple quantified strategy enhanced

Today I came across the following post: When SPY Falls 2 Times More Than Average Change on the Quantified Strategies blog by Oddmund Grotte. As I am looking for a more quantified approach for my investing / trading, I decided to do a back test on the strategy explained in the post. The strategy is as follows:

  • We calculate the 25 day moving average of the absolute value of the daily differences.
  • When the SPY moves down by more then 2 times the calculated moving average, we go long on the close.
  • We exit again on the next days close.
So this is a nice reversion to the mean strategy. It basically takes advantage of the fact that prices never move in a straight line, but rather move up and down around a certain average price. When price has moved away to far from the average, there is a higher probability that the price will move back to the mean.

My back test achieved about the same result as Oddmund's. Then I enhanced it a little bit by filtering out entry days that on average seem to be losing days. Like Oddmund I also found that entering on Thursday closes reduces the total return of the strategy. So I filtered these out.

We therefore should add to the strategy:
  • No entries on Thursday closes
Here is my back test result. I added the S&P500 cumulative daily differences for comparison.
SPY Strategy
As you can see the strategy is pretty stable. There are no large draw downs (visually). In fact, it looks like it is performing best when the index is in general moving down. Also this strategy took 148 trades in 8+ years. That is roughly 18 trades per year or 1 trade every three weeks. However the strategy is not clearly out performing a simple buy and hold strategy. If you would have bought an ETF on the SPY you would be up 63%, while the strategy would have made you 49%. Of course, the strategy does not tie up your money like a buy and hold strategy. So with this strategy you could put your money to work using other strategies.

Still, it would be nice if the strategy could, by itself, outperform a buy and hold approach, so I tried to optimize it. I found, that by going long every time the SPY moves down by more than 1 time the moving average, the performance improves substantially.

SPY Strategy enhanced
Notice that the total return (P&L) moved up from 49% to 85%. At the same time the sharpe ratio is only slightly lower (1.12 i/o 1.17). "So were is the catch?", you might say. Well, this back test took more then double the amount of trades, 388 in total. This calculates back to about 48 trades per year or about 1 trade every week. So the extra performance comes at the cost of trading more actively, which will also lead to higher transaction costs and to having our money tied up in a trade more often.

To get a feel for the long term perspective of this strategy, I did the same back tests on data from 1993 until now. Again setting the "price move down" parameter to 1 seems to give better performance. The total return even doubles and the sharpe ratio also gets better.

SPY Strategy back test since 1993

SPY Strategy enhanced back test since 1993
The question now is: can anyone do this for about 20 years; checking the close price daily, calculate, place orders and exit trades? It would be great if we could automate this process, so the execution of the strategy will take little to no time. At the same time we could do the same for other strategies, building a dynamic portfolio. This is something I will be working towards.

And then there is leverage. Imagine executing this strategy (and others) with about 1 to 10 leverage. This would possibly enlarge the total return by a factor of 10 (minus extra cost for leverage). Before even considering this, I want to investigate the strategy more by figuring out the max draw down, the win - loose rate, optimal position sizing, etc. Because if there is a draw down of 10% and we are leveraged 1 to 10 with our full account, we are out of the game.

I am thinking that if I can combine this strategy with others, automate the process and use just a small amount of leverage, I will be well on my way in becoming financially independent.

Popular posts from this blog

Invest like a trader

Here is my book: "Invest like a trader". I finally decided to create this book based on my blog and experience investing, trading and coding. It is an introduction to my view on investing. For the next few days you can get a free copy on Amazon:

This book is for you if you are an investor looking to learn a more trading-like approach to investing. Buy and hold investing has become buy and pray investing, with countless sleepless nights. A more trading-like approach to investing puts you back into control of your investments and it can be a lot of fun. After reading this book you should be more able to build and grow your investment account consistently.

Link to the e-book:
Let me know what you think after reading the book. You can contact me via email or on social media. Even better, you can leave a review on Amazon.

Why I am a trader and investor and why you might wanna be one too

I am a coder by day and trader by night! Coding is my day job. I am fully aware that only having a job will not allow me to provide for my family and myself consistently in the long run. This is because most of the western societies are setup in a way to be more and more disadvantageous towards the working middle class. I do not need to be a billionaire to be happy, but our society is becoming more and more binary. It seems that one can either be rich or poor, in which case I opt to be rich, or at least hedge myself against being poor. Trading and investing are my hedge against this trend.

The super rich and us Below are two videos from the BBC documentary "The Super Rich and Us". It clearly illustrates and explains the polarization of wealth distribution in our current society. Here is a catchy quote from the documentary:

There are the haves, the haves not and the haves yachts! But actually we seem to be heading for a society where there are only haves not and haves yachts

Why I buy Gold and Silver

I own crypto currencies, because I have come to the conclusion that money as we know it today is no longer sustainable. I have come to this conclusion during the crisis of 2008. At that time I had the intuition / the gut feeling something was wrong not only with our financial system, but more specifically with our money. It took a few years of researching and investigating until I figured it out. The thing is, part of me did not want to believe it was true. And for a long time I did not act upon the intuition and knowledge I had. That changed last year when I decided to put my money where my mouth is and I started to accumulate crypto currencies. Cryptos align perfectly with my expertises: coding and trading. So I went for it... And with success.

Now I want to diversify my holdings more by adding Gold and Silver to it. I buy Gold and Silver as a hedge or insurance against the undwindled money printing of all of the governments / central banks of the world. Money, or actually, currenc…