mean reversion

Posted on Nov 24, 2020 by Kris Longmore

I'm a big fan of Ernie Chan's quant trading books: Quantitative Trading, Algorithmic Trading, and Machine Trading. There are some great insights in there, but the thing I like most is the simple but thorough treatment of various edges and the quant tools you might use to research and trade them. Ernie explicitly states that the examples in the books won't be tradable, but they've certainly provided fertile ground for ideas. In Machine Trading, there is an FX strategy based on an autoregressive model of intraday price data. It has a remarkably attractive pre-cost equity curve, and since I am attracted to shiny objects, I thought I'd take a closer look. Autoregressive Models 101 An autoregressive (AR) model is a time-series multiple regression where: the predictors are past values of the time series the target is the next realisation of the time series If we used a single prior value as the only predictor, the AR model would be called an [latex]AR(1)[/latex] and it would look like: [latex] y_t = \beta_0 + \beta_1 y_{t-1} + \epsilon_t [/latex] (the [latex]\beta[/latex]'s are...

Posted on Jan 03, 2017 by Kris Longmore

What if you had a tool that could help you decide when to apply mean reversion strategies and when to apply momentum to a particular time series? That's the promise of the Hurst exponent, which helps characterise a time series as mean reverting, trending, or a random walk. For a brief introduction to Hurst, including some Python code for its calculation, check out our previous post. Even if you have read this post previously, it is worth checking out again as we have updated our method for calculating Hurst and believe this new implementation is more accurate. It would be great if we could plug some historical time series data into the Hurst algorithm and know whether we expect the time series to mean revert or trend. But as is usually the case when we apply such tools to the financial domain, it isn't quite that straightforward. In the last post, we noted that Hurst gives different results depending on how it is calculated; this begs the question of how to choose a calculation method intelligently so that we avoid choosing...

Posted on Oct 31, 2016 by Kris Longmore

This is the first post in a two-part series about the Hurst Exponent. Tom and I worked on this series together and I drew on some of his previously published work as well as other sources like UPDATE 03/01/16: Please note that the Python code below has been updated with a more accurate algorithm for calculating Hurst Exponent. Mean-reverting time series have long been a fruitful playground for quantitative traders. In fact, some of the biggest names in quant trading allegedly made their fortunes exploiting mean reversion of financial time series such as artificially constructed spreads, which are used in pairs trading. Identifying mean reversion is therefore of significant interest to algorithmic traders. This is not as simple as it sounds, in part due to the non-stationary nature of financial data. We both think that Ernie Chan's book “Algorithmic Trading: Winning Strategies and Their Rationale”, is one of the better introductions to mean reversion available in the public domain. In the book, Ernie talks about several tools that can be used when testing if a time series is mean reverting. One is the...

Posted on Jan 02, 2016 by Kris Longmore

In the first Mean Reversion and Cointegration post, I explored mean reversion of individual financial time series using techniques such as the Augmented Dickey-Fuller test, the Hurst exponent and the Ornstein-Uhlenbeck equation for a mean reverting stochastic process. I also presented a simple linear mean reversion strategy as a proof of concept. In this post, I’ll explore artificial stationary time series and will present a more practical trading strategy for exploiting mean reversion. Again this work is based on Ernie Chan's Algorithmic Trading, which I highly recommend and have used as inspiration for a great deal of my own research. Go easy on my design abilities... In presenting my results, I have purposefully shown equity curves from mean reversion strategies that go through periods of stellar performance as well as periods so bad that they would send most traders broke. Rather than cherry pick the good performance, I want to demonstrate what I think is of utmost importance in this type of trading, namely that the nature of mean reversion for any financial time series is constantly changing. At times this dynamism can...

Posted on Dec 03, 2015 by Kris Longmore

This series of posts is inspired by several chapters from Ernie Chan's highly recommended book Algorithmic Trading. The book follows Ernie's first contribution, Quantitative Trading, and focuses on testing and implementing a number of strategies that exploit measurable market inefficiencies. I'm a big fan of Ernie's work and have used his material as inspiration for a great deal of my own research. My earlier posts about accounting for randomness (here and here) were inspired by the first chapter of Algorithmic Trading. Ernie works in MATLAB, but I'll be using R and Zorro. Ernie cites Daniel Kahneman's interesting example of mean reversion in the world around us: the Sports Illustrated jinx, namely that "an athlete whose picture appears on the cover of the magazine is doomed to perform poorly the following season" (Kahneman, 2011). Performance can be thought of as being randomly distributed around a mean, so exceptionally good performance one year (resulting in the appearance on the cover of Sports Illustrated) is likely to be followed by performances that are closer to the average. Mean reversion also exists in, or can be constructed from, financial time series...