• riccardo

Trading the reversion to the mean – Part 2

Updated: Aug 29, 2020

#decisionMaking #riskManagement #quantitativeIntuition


 

Following the post Reversion to the mean? Still tough to profit from it, it could be useful to show an actual application. It is key to understand that the difficulty of leveraging the probable reversion toward the mean of events applies to many different domains, not only the specific one discussed here. It is the underlying distribution of events that determines the specific behavior. We will discuss below, a trading algorithm trying to leverage the probable reversion toward the mean after extreme stocks' returns have occurred. As we will see, gains based on that reversion are threatened by the three factors described in the first post: limited resources, big swings, and long streaks in one direction. Here is a brief recap:


Limited resources make timing essential. We cannot be stuck in losing positions for too long. Problem is, timing is tough. Timing could be even impossible in non-Gaussian distributions. Those dangerous statistics could be characterized by the majority of the values being below the average (i.e. long streaks of growing or decreasing trends) and being balanced by few rare big outliers (i.e. big swings). The average value becomes just a mathematical and non-verified number. The picture below could give us an idea of what we are talking about. It represents the number of car-brands by US sales figures. What could we predict to be the sales of a new entry in the market? Tough to say: the average value (red line) is met by only one manufacturer, most of them are below that mathematical average, and only a few are far beyond that - to an extend beyond what a Gaussian distribution would suggest and more similar to Pareto phenomena.



Application – Trading algorithm based on reversion toward the mean


A couple of years ago I built a trading algorithm trying to exploit the probable inversion of extreme movements of stocks. This is a known and largely studied application in finance, however, I wanted to build my version to understand first-hand the real potential. I tested my algo on a common cloud-platform where it is possible to back-test codes against past market-data. The algorithm was designed to buy stocks which had recently lost too much (e.g. beyond 2 standard deviations of their past returns) and short [sell] stocks which had recently gained too much. Overall the results were not too bad - I even received a t-shirt from the platform provider – however, as we will see, results were in general not really promising either.


Note: if the reader is interested in testing or has already tested her / his version of similar algorithms, attention should be paid on the testing conditions. Back-testing is usually done with end-of-day values, which could represent very different situations compared to tougher-to-handle live conditions.


I will immediately dive into one of the results I obtained while back-testing my algorithm and tweaking its parameters. The picture below shows the return of my strategy (blue line) across 5 years of market-data compared to the overall market performances (red line).



I tried to highlight in the picture how my algo usually profits from mild stocks' swings [A], while it generally loses during long-term trends in one direction [B] - which in this case happened to be all upwards. In this particular simulation there were not big swings, so, the main factor negatively impacting my result was the long-term streaks in one direction. That is particularly evident in the last segment identified by the last letter B to the right in the picture. The algo in those situations was expecting a reversion toward the mean, it was, therefore, shorting a lot of stocks. Those assets, however, kept rising beyond usual Gaussian expectations making my positions lose more and more in time (a problem related also to limited resources). It is important to note that the exact correspondence in time of my gaining and losing moments compared to the ones of the market were influenced also by the parameters I chose. In other simulations I tried different target-movements (e.g. 1.5 standard deviations or 3) and that shifted a bit the two lines. However, the overall result would stay similar. Moreover, while back-testing the same algo across different periods of time of the same length, the results varied significantly - not a good indication, somebody could mention over-fitting.


While only few algorithms I built based on this strategy actually lost money - below 0% at the far right end - the algorithms always failed to beat the market (red line). I have to specify: this is not in any way meant to be an investment recommendation.


Conclusion


I hope this little application shows how, while reversion toward the mean is indeed what we could expect from phenomena which have gone too far in one direction, the distributions often characterizing real-life applications make that knowledge tough to leverage. Those statistics are usually more Power-Law distributed (e.g. Pareto) rather than Gaussian. As we discussed more extensively in the previous post, three of the major factors negatively contributing to our results are:

  1. Limited resources

  2. Big swings

  3. Long-term dependence of events (long-term trends)


 

Main image's source: