Reviewing 2016

Another year has passed, and just like last time, I’ll summarise 2016 below.

2015 was a rather flat year, with the opportunity index hovering around 30 throughout the year. 2016 was a lot less boring, with an ever increasing opportunity index, reflected in the index value also heading north. Besides a dip below 30 around August, and some initial below 30 values at the beginning of the year, this development allowed us to stay in the market throughout most of the year, capturing whatever gain was there while avoiding negative and uncertain territory.

With default settings, this gave us a nice alpha value of about 13%, at a beta of 1.29. With an initial index value of 2052.67, the active performance ended at 2663.24 while the passive S&P 500 value ended at 2244.41. As always, feel free to click the image above to dive into the details.

PS: I’ll be stopping the stock pick publishing that has been published to Github at the end of each month. I’ve not followed up on this and believe it was prematurely made available, compared to some of the internal development progress made with regards to single stock selection.

Looking back at 2015

Happy New Year, guys!

It most definitely is time to give an update to this blog. Rest assured, I’m still here, just been rather busy working on my ranking algorithm (and I found it a bit boring to do, almost mechanical, monthly updates as I tried for a while.) I alluded to some of the direction I was going in one of my previous blog posts. We’ll see how or if that pans out publicly here or on the GitHub repository, but good progress has been made. The results might be too good to share freely.

I thought I’d summarise 2015 with regards to the opportunity index. 2015 was, well, pretty flat. It’s difficult to beat an index by being either long, short, or out of the market on that index, when things are generally flat. But there was some significant movement, a couple of times, and over all, as in 2014, we ended our portfolio value higher than the benchmark. With 2015 starting at 2071.13, it ended at 2052.67 for the S&P 500, while the active strategy managed 2124.46.

AOMOI-2015

In addition to that, we also logged a positive alpha at 3.43%, still sticking to the default settings.

Other potentially interesting observations:

  • The general trend for the opportunity index has been going down throughout 2015.
  • This has towards the end manifested itself as us being out of the market for the majority the last two months.
  • We are now very close to and slightly below an indicator value of 30. Things might jump up again quickly. But generally, all of 2015 showed little sign of wanting to be too far above this level.

2016 certainly didn’t get off to the best start (if you’re long), but it will be interesting to continue to follow its development.

Sell in May and go away – part 3

So far in part 1 and part 2 we’ve established that:

  1. There has historically been lower, or negative returns, in summer months, compared to higher returns the rest of the year.
  2. This tendency has been there since the 1950s, and seems to be getting stronger/more significant.
  3. It doesn’t make much difference what the average historical risk-free rate is, used when we’re out-of-market.

So that’s all strong indicators that something is going on in the summer months. Maybe holiday and warmer weather is to blame? If so, it could be interesting to see if this is still the case for markets on the southern hemisphere.

However, we’ve yet to include dividends in our analysis. So how would dividends change the outcome? Assume we reinvest any dividends we receive; Doing that would increase our exposure to any future market changes. Does this have an impact? Well, of course, as we can see in the below graph showing returns vs total returns. For the record, you can find the original source of this dividend data from Robert Shiller’s online data page, with a handy tool for exploring it available here. Also for the record: The cost of reinvesting dividends are not included.

S&P 500 returns vs total returns

So that’s it then? No point worrying about selling stocks in May? No, as I’ve said multiple times before: Leverage in itself is not an intelligent strategy. And given that reinvesting dividends is essentially just increasing your leverage, this is not the end of the story.

In part 1 we looked at monthly average and median returns. Let’s repeat that and compare monthly average/median returns with/without dividend reinvestment.

Average monthly returns vs total returns

Median monthly returns vs total returns

The above bar charts tell us the same story we’ve seen before. Sure, it’s not as strong, but even with dividends included, returns tend to be less in summer months. If we were to apply the previously used Sell-in-May strategy as done in part 1, but now using total returns, the below graph should show the value development over time:

TR Sell-in-May vs Buy-and-Hold

Ok, yes, I hear you saying the same thing you’ve said before: The active Sell-in-May strategy is below the passive Buy-and-Hold strategy! Then again, this is not the complete picture. Is there positive alpha on the active vs passive strategy?

Yes: We find an annualised alpha of about 5.4%, highly significant, with a beta of 0.42. See the output of analysis_3a.clj for the details.

I promised you applying a vaguely defined term called smart beta in part 2, so let’s do that. This is applied as part of analysis_3b.clj. Given the mechanical and simple Sell-in-May strategy, we don’t need to do much complicated stuff here. I want to end up with an active strategy that gets a beta close to one, so that we can utilise our alpha to end up with a higher absolute value compared to the passive Buy-and-Hold strategy. I’ll leverage our exposure so that we’re 1.5x in when we’re not between May-October. When the Sell-in-May strategy dictates that we should be out-of-market, leverage is reduced to 0.5x. We could have invested the other half in risk-free interest, but that’s not included. Assume instead that we use that interest to fund our increased leverage when we’re 1.5x, keeping it simple.

First let’s see how this performs in distinct 10 year periods:

TR Renormalised Active vs Passive S&P 500

For each and every 10 year period the active ends up with a higher final value than the passive. Put together we get this:

Smart Beta vs Passive TR

Over a 65 year period this active strategy returns almost 3.8x the passive Buy-and-Hold total return strategy. In alpha/beta terms the annualised alpha is around 2.8% with a beta of 0.93.

That concludes our little journey into this market anomaly.

Sell in May and go away – part 2

The spring weather has been good in London the last few days, so looking at lowering the historical average risk free rates haven’t been that tempting.

But it needs to happen, as part 1 left a few loose ends.

Two things of interest will be addressed in this post:

1: How does different levels of interest affect the Sell-in-May strategy,

and

2: Are there differences between different time periods as to how effective the strategy has been? Or more specifically, is the summer period a consistently good period to be out-of-market?

After posting the first round I’ve been tipped off about a few other articles and views concluding differently than my first post. Well, first off: I’m not attempting to claim anything in particular. But, those other views are lacking I’d argue.

It’s easy to just focus on the final value of some strategy, but that’s not really the full picture..

I’ve used this as an example in similar situations, but I should reiterate it here: Assume you had 2x leverage and the market went up 10%. You would then make 20% (minus leverage cost, etc..). And if things go down 10%, you are down 20%. So far you’re doing nothing more than putting on more risk. The most inexperienced retail trader can do, and does do, this every day, without regard for the implications. Not that the banks have done much better, by the way..

If you however managed to time your leverage so that you, for example, were 2x exposed when things went up and 1x, 0x, or maybe even -1x when things are (potentially) going down, then you start showing some market timing abilities. In other words: There are more than just one way of applying a strategy.

So if you’re going to tell me about some other article that is showing me that the final value of some portfolio is more or less than some other portfolio, please include something more than just a single percentage value.

But I digress, because there are valid limitations to the first post, and that’s transaction cost.

You can model transaction costs in many ways, but one option in this particular case is to view it as a reduced risk free rate. So, as I’m still not going to include explicit transaction costs in my analysis, you can easily account for them..

The other aspect is either something you’d describe as positive/negative feedback loops or just intra time period randomness: Does the strategy work within different subsections of our overall period?

Questions to ask with regards to this is related to stability of optimal strategy between periods, and if this is deterministically shifting as time moves forward.

As before there is a GitHub area with code and data, updated to reflect the additions in this post. So let’s start with variable interest received while out-of-market.

S&P500 with variable risk free rate

Not surprisingly the final value of our various strategies get lower as we reduce the out-of-market risk-free rate. However, how does this affect our alpha/beta stats?

OOM risk free rate Annualised Alpha Alpha T-probs Beta
5% 4.64% 2.533E-7 0.409
4% 4.13% 4.302E-6 0.409
3% 3.63% 5.473E-5 0.410
2% 3.13% 5.189E-4 0.410
1% 2.62% 0.003656 0.411
0% 2.12% 0.019169 0.412
-1% 1.61% 0.07519 0.412

All alpha values remain positive with the majority remaining significant at a 1% level. In other words, neither the risk-free rate nor an implied transaction cost (illustrated through reduced risk-free rate) seem to impact the observations we’ve seen earlier to much extent.

Finally we are looking at how things change over time. Is the out-of-market strategy working when we divide the overall period into sub-periods?

Generally of the opinion that changing more than one variable at a time quickly generate more confusion than insight: I’m again locking the risk free rate so that all we’re looking to change between differing simulations is the time period.

Renormalised Active vs Passive S&P 500

 

Supplemented with alpha/beta stats below we see that alpha remains positive for all the periods. The significance level is a bit all over the place which is probably also related to only having 120 monthly observations in each period. However, if you were forced to conclude anything based on significance we could state that they have stabilised on a 5% significance level the last 30 years.

Period Annualised Alpha Alpha T-probs Beta
[1955, 1965) 3.14% 0.113185 0.448
[1965, 1975) 2.77% 0.228970 0.381
[1975, 1985) 1.41% 0.550809 0.499
[1985, 1995) 10.29% 2.857E-5 0.363
[1995, 2005) 5.26% 0.034520 0.373
[2005, 2015) 4.67% 0.047881 0.406

A lot of stuff has been covered now by this post and the previous. One final question worth digging into is dividends, and potentially something called smart beta. That will be the subject in the final round next time.

Sell in May and go away?

Steen Jakobsen, Saxo Bank A/S’s chief economist, was recently quoted saying you should sell your stocks and take 6 months off. The timing might be incidental but this is very much in line with an investment strategy called “Sell in May and go away“.

But can really such a simple strategy work, and why would it? Although I’m not attempting to conclude on why this should work it’s still interesting to spend a little time analysing the data. Previous work has been done to conclude on the statistical significance of this phenomenon, for example by Bouman and Jacobsen (2002) showing that the effect has indeed occurred over a long period of time.

So let’s spend a little time digging into over 60 years of S&P 500 data, going back to 1950. If you want to play around with this yourself you’ll find my code and data on GitHub. Below is our first graph. It shows the S&P 500 ranging over our complete data set, based on monthly prices.

S&P 500 all price

Besides showing the obvious there’s not much we can easily tell from looking at this in relation to the strategy. Would looking at the monthly returns help out?

S&P500 all returns

No, not really. Maybe we can make out that some of the years seems to show less positive returns towards the end of some of the years, but it’s not really clear overall. We would be guessing.. Instead, let’s group each year by it’s months and look at the average returns per month over all the years:

S&P500 average monthly returns

Aha, this is starting to show something of interest. We can clearly see that returns tends to be less positive, or even negative, on average in the middle of the year (1 = January, 2 = February, .., 12 = December), and a lot more positive at the beginning or end of the year. We would be interested in protecting ourselves from negative returns, so the strategy is starting to show some promise. This could however be skewed by outliers, so let’s also have a look at the median monthly returns:

S&P 500 median monthly returns

Ok, things aren’t so clear now. Using median returns things does seem to generally drift upwards. The question then is: What do you do with your cash when it’s not invested in the stock market? Assuming we put them in high caliber (“risk-free”) interest bearing fixed income instrument they would still give us a return on our investment while we’re out of the stock market. Based on data from various historical sources I’ll stick with an average annual geometric risk-free rate of 5%. This would very much be a limiting factor in the below analysis as a time dependent historical rate would be more optimal. For the record, I’ll also skip on the transaction costs, keeping it simple.

So given that, how would our active “sell at start of May, reinvest at end of October” strategy perform? Below we compare this active to a passive buy-and-hold strategy, with a normalised price starting at 100:

Sell-in-May vs Buy-and-Hold

The active does indeed eventually end up at a higher final value that the passive buy-and-hold. This however isn’t that interesting in itself given that our beta is now intuitively around half of the overall market. Running a regression we find the beta to actually be 0.41 on the above case. Does the strategy give us any positive alpha however? Yes it does, at almost 5% when annualised (t-prob = 2.53E-7).

You can use this for whatever you feel it’s worth, either as a slap in the face of the so called efficient markets or merely as an interesting ambiguity. I would be careful in blindly following it, given the limited understanding of why it would happen, making it difficult, if not impossible, to predict if it’s going to happen this year or the year after. Build an understanding of that and it becomes very interesting.

Another question is: Why May, and why October? Would there be other time periods that have been more optimal than just those two months? Sticking to 6 months in the market and 6 months out, we can easily shift the periods, as shown below:

Time period out-of-market Alpha T-probs
January-June 0.001628891086934963 0.027563354388632444
February-July 0.0019077562657180062 0.01115352599672903
March-August 0.003657645507896297 1.479701652318255E-6
April-September 0.00479897125435165 2.140849719722837E-10
May-October 0.003864560505495917 2.533265377469007E-7
June-November 0.002391794653946798 0.0014218779680315041
July-December 0.002537775579731788 6.140698693479774E-4
August-January 0.002258910400948748 0.0026777631120809
September-February 5.090211587704075E-4 0.4997617143696407
October-March -6.323045876849712E-4 0.39668575465853984
November-April 3.0210616117079146E-4 0.6844131501587507
December-May 0.0017748720127199694 0.017749704340670025

Illustrated differently, below are the (annualised) alpha values plotted as straight lines, where the length/position of the lines indicate when we were out-of-market:

Alpha-Timeline

The vast majority of these alphas are significant at a 5% or 1% level, with the exception of the practically zero alphas when we stay out of the market during autumn/winter time. This is also very much in accordance with the initial strategy stating you should be in the market besides summer months. Applying these different strategies would give us this graph:

Different Out-of-Market periods

The yellow April-September plotline performs best, as also shown by the the alpha table. It could be interesting to see if this is the case for multiple subsets of the overall timeline. Could it be that there’s a positive feedback loop involved here, where, due to people following the “Sell in May” strategy, it did at some point become more profitable to jump ahead of the crowd?

That question, and others, like, does the risk-free rate change the outcome significantly, is subject of later blog posts.

Things back to normal

Just a quick follow up: The data issue as described in the previous post has been fixed, and processing has catched up to current latest available input. So things are back to normal again..

Garbage in, garbage out

Late October some bad input data made it into the system. This has sadly affected the systems ability to correctly produce output. As they say in Computer Science: Garbage in, garbage out.

I’ll be working on rectifying the bad data the next coming days and rerunning all needed steps in order to repost the web app data. I’ll also add a few more extra steps to ensure the quality of the data we receive, avoiding this in the future.

More to come when things have been fixed.

How bad is a big drop?

Early Saturday morning a new indicator value was published as normal. But what wasn’t normal was the massive drop this new indicator showed compared to the previous weeks value. What’s the impact of such a big drop?

We’ve all seen the news. Bad things are happening many places in the world, and various ways of incorporating this into financial markets are manifesting themselves. But is this more than just a short blip or drop in the ocean?

In this post I’ll look at the biggest drops in indicator value, and look at longer term impact of these drops in isolation. In other words, does a single big drop down bring a longer term downfall in the S&P 500 index?

First of all, how big was the indicator drop compared to other big drops over the last 30 years or so?

20 biggest drops in indicator value
Top drop rank Indicator drop Indicator value after drop Date
1 -73 10 1992-05-22
2 -72 24 1986-09-26
3 -70 4 2004-10-22
4 -66 6 2002-04-05
4 -66 16 2002-03-01
6 -57 16 2001-06-29
7 -56 9 1995-12-22
8 -51 15 1996-07-19
9 -47 43 1991-02-08
10 -45 12 1987-09-25
10 -45 20 2014-07-18
12 -44 33 2004-03-12
12 -44 43 2005-05-06
14 -43 25 1985-08-02
14 -43 37 2007-06-08
16 -41 7 1999-03-12
16 -41 21 1984-02-10
16 -41 23 2004-09-03
19 -39 19 2002-02-08
20 -36 40 2010-03-19

We can see from this that the drop on data available as of 18th on July 2014 represents a shared 10th place of biggest indicator drops ever. That is pretty huge, and we know from earlier analysis (see 1980s, 1990s, 2000s) that indicator values below 30 generally indicate reduced index returns.

But it’s still just a single value at a single point in time. Does it still indicate future decline? Below is a chart that shows the normalized change in price the next 250 trading days from when the indicator drop occurred.

Change in S&P 500 index after big indicator drop

Change in S&P 500 index after big indicator drop

We can see that for the majority of the cases, one year later, the index is above its starting value. Put differently, a single indicator value drop a year back is not a good long term predictor. Instead, what if we look at the price development of the index compared to the average indicator value during that period.

S&P 500 index vs avg indicator

This picture gives us some more information. Generally, a big single drop does not in itself imply an average low indicator value over the next one year. The average indicator value just after the big drop is 21.15, while the average among all one year average indicators is 41.59. And as we’ve seen earlier, only during continuously low indicator values can we expect lower or negative index returns. To recap a thing stated on the “Learn more” page: “The key is to react quickly when needed.”

Update: As always, see the app, but here’s the drop I’m talking about:

big-drop-2014

Historical review: 2000s

With the awfully boring 1990s behind us, it’s time to look at a much more interesting period: The 2000s. During these 10 years not only did we see a prolonged period of a downwards trend during the first few years, we also saw the market go off a cliff towards the end, later named the Great Recession.

Peeking at just above 1500 towards the end of August, 2000, the S&P 500 started falling and didn’t stop doing so until around February 2003. It was then at just above 800. You’d really need to have good nerves if you blindly believed in the market going up in the long run during a period like this. So how did the indicator capture and react to such a clear downwards trend?

Below is the first half of this decade, showing the indicator value and market:

first-half-2000s

Not only does the indicator capture this perfectly, giving a clear indication from the beginning of May 2000 when it drops to a value of 6, but it generally stays low till the end of the downwards trend picking up in value again around February/March 2003.

Within that period there are two attempts at moving to a higher indicator value. The first, during the middle of 2001 is short lived and doesn’t bring much. The second is stronger, reaching a value of 91 in November 2001, starting the month before and did managed to capture some of a small upswing within this overall downwards trend.

What then happens early in 2003 is a gradually stronger indicator. This actually starts happening mid-2002, but is too low to act upon. Generally staying strong from then on we’re able to perfectly capture the trend reversal and enjoy the market upswing all the way till the beginning of 2004. Here we now see the indicator beginning to fall again, in reaction to the now changing market conditions. Even if the market is going slightly down in this period, mid 2004, you might want to call it a sideways market. We end this first half well, again enjoying an upwards moving market.

Before moving on the the next half, let’s look at parameters. During the 1980s the most optimal indicator cut-point was 40, producing an alpha of 7.80% pa. During the 1990s, the most optimal indicator cut-point was 30, producing only the slightest advantage. For this first half of the 2000s, the optimal point was 30, but 40 wouldn’t have done bad either. Again we see persistence in the parameters, crucial if we are to apply the indicator, with 30 showing the overall best results. If you need a recap on how these parameters are applied, have a look at this post, in addition to the “learn more” page.

Below is the second half of the 2000s, again sticking to a cut-point of 30:

second-half-2000s

Besides the first stretch, it’s pretty nasty. Sadly, being honest, the indicator didn’t manage to react early enough to get out at the peak. But it did manage to give a clear indication at the very bottom. In fact, it might have reacted slightly early, which is not necessarily a bad thing, but does give a rather nasty drop in our actively managed portfolio when we choose to re-enter the market at the beginning of 2009. In reality you could argue that given a more advanced trading strategy we could enter the market in a more risk averse manner than simply going long as is done in the web app. But we’re keeping things simple for now. And we still managed to produce an alpha of over 10% pa during this last half, so things are not bad.

That pretty much sums up the three post series of the 1980s, 1990s, and here the 2000s. I hope it has given you some insight and ideas about the potential power of the indicator.

 

 

Historical review: 1990s

This post has been slightly delayed, for two reasons:

  1. The FIFA World Cup is on, so plenty of reasons not to bother writing blog posts
  2. The 1990s was pretty boring, with regards to our benchmark index

So what does boring imply with regards to applying the indicator? Well, not much happened, not many big changes. The only slightly interesting drop was towards the end, really.

So what are we left with then?

Let’s assume you had access to the AgoraOpus indicator at 1st of January 1990. And you did some back-testing and landed on the most optimal indicator cut-point, according to your preference. Looking back at the 1980s, this is what’s you’d pick for that period:

1980-optimal-1

Applying the same parameters blindly to the next 10 years during the 1990s would have given you this:

1990-based-on-1980-optimal-1

Although not as fantastic as the 1980s, it’s nothing to cry about. What can you expect with no big shorting opportunities? And finally, if we optimize on alpha, the optimal point was just 10 off the selected. That’s an important point: We’re starting to see persistence in parameters. This is something you want with any type of trading system.

I’ll leave it at that for now, and promise you a lot more excitement in the next decade. Till then, enjoy the world cup!