Blog

Explore the research behind our trading, plus some just-for-fun stuff....

Posted on Feb 04, 2016 by Kris Longmore
22 comments.
8,344 Views

[latexpage] Recently, I wrote about fitting mean-reversion time series models to financial data and using the models' predictions as the basis of a trading strategy. Continuing my exploration of time series modelling, I decided to research the autoregressive and conditionally heteroskedastic family of time series models. In particular, I wanted to understand the autogressive integrated moving average (ARIMA) and generalized autoregressive conditional heteroskedasticity (GARCH) models, since they are referenced frequently in the quantitative finance literature, and its about time I got up to speed. What follows is a summary of what I learned about these models, a general fitting procedure and a simple trading strategy based on the forecasts of a fitted model. Several definitions are necessary to set the scene. I don't want to reproduce the theory I've been wading through; rather here is my very high level summary of what I've learned about time series modelling, in particular the ARIMA and GARCH models and how they are related to their component models: At its most basic level, fitting ARIMA and GARCH models is an exercise in uncovering the way in...

Posted on Jan 02, 2016 by Kris Longmore
27 comments.
6,689 Views

In the first post in this series, 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. 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 be accounted for by updating the hedge...

Posted on Dec 03, 2015 by Kris Longmore
28 comments.
5,714 Views

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...

Posted on Nov 24, 2015 by Kris Longmore
5 comments.
266 Views

Important preface: This post is in no way intended to showcase a particular trading strategy. It is purely to share and demonstrate the use of the framework I've put together to speed the research and development process for a particular type of trading strategy. Comments and critiques regarding the framework and the methodology used are most welcome. Backtest results presented are for illustrating the methodology and describing the outputs only. That done, on to the interesting stuff My last two posts (Part 1 here and Part 2 here) explored applying the k-means clustering algorithm for unsupervised discovery of candlestick patterns. The results were interesting enough (to me at least) to justify further research in this domain, but nothing presented thus far would be of much use in a standalone trading system. There are many possible directions in which this research could go. Some ideas that could be worth pursuing include: Providing the clustering algorithm with other data, such as trend or volatility information; Extending the search to include two- and three-day patterns; Varying the number of clusters; Searching across markets and asset...

Posted on Nov 15, 2015 by Kris Longmore
20 comments.
1,789 Views

In the last article, I described an application of the k-means clustering algorithm for classifying candlesticks based on the relative position of their open, high, low and close. This was a simple enough exercise, but now I tackle something more challenging: isolating information that is both useful and practical to real trading. I'll initially try two approaches: Investigate whether there are any statistically significant patterns in certain clusters following others Investigate the distribution of next day returns following the appearance of a candle from each cluster The insights gained from this analysis will hopefully inform the next direction of this research. Data preliminaries In the last article, I classified twelve months of daily candles (June 2014 - July 2015) into eight clusters. To simplify the analysis and ensure that enough instances of each cluster are observed, I'll reduce the number of clusters to four and extend the history to cover 2008-2015. I'll exclude my 2015 data for now in case I need a final, unseen test set at some point in the future. Here's a subset of the candles over the entire price history (2008-2014, 2015...

Posted on Nov 10, 2015 by Kris Longmore
19 comments.
6,462 Views

Candlestick patterns were used to trade the rice market in Japan back in the 1800's. Steve Nison popularised the idea in the western world and claims that the technique, which is based on the premise that the appearance of certain patterns portend the future direction of the market, is applicable to modern financial markets. Today, he has a fancy website where he sells trading courses. Strange that he doesn't keep this hugely profitable system to himself and make tons of money. Since you're reading a blog about quantitative trading, its unlikely that I need to convince you that patterns like "two crows" and "dark cloud cover" are not statistically significant predictors of the future (but I'd be happy to do a post about this if there is any interest - let me know in the comments). If only profitable trading were that easy! So if these well-known patterns don't have predictive power, are there any patterns that do? And if so, how could they be discovered? Unsupervised machine learning techniques offer one such potential solution. An unsupervised learner is simply one that...