Friday, June 22, 2007

Pair trading stocks and the life-cycle of strategies

I have discussed in various articles trading the spreads between pairs of ETF’s, or between a basket of stocks against an ETF using cointegration technique. There is, however, a glaring omission, as I haven’t yet mentioned the classic statistical arbitrage strategy: pair-trading stocks.

There are pros and cons on applying cointegration to pair-trading stocks. On the pro side: because of the large number of stocks, we can enjoy a highly diversified portfolio that improves the validity of our results. Even if a number of spreads fail to cointegrate going forward, we can count on a larger number of spreads that still do. (For e.g. my USO-XLE spread fell apart, while GLD-GDX spread is still tightly cointegrated.) There are 2 main cons: 1) stocks are subject to various specific risks which may render our purely statistical model useless, especially in M&A situations. Therefore it is customary to remove such stocks from our portfolio when they are involved in special situations – however, by the time the news is public we may have incurred substantial loss already; also 2) because of the technique’s long history, it became known to many hedge funds and indeed students of finance, and therefore pair trading stocks has not been very profitable, especially in the period 2003-2005. Here I plotted the excess returns of the strategy as applied to US bank stocks from 20010102-20041231. (Excess returns means credit interest on margin balance is not included.)

Interestingly, when a strategy becomes too popular and less profitable, many traders start to abandon it, or at least reduce their trading capital invested in the strategy. After a while, its popularity decreases, and the profitability recovers! This life-cycle of strategies reveals itself as mean-reversion of strategies, on top of mean-reversion of stock prices. In our case, this strategy recovery starts in 2005, and is still in full-force. Here I plotted the excess returns of the strategy as applied to US bank stocks from 20050103 to 20070531:


The average annual excess return in 2005-now is about 7.7% (on one-side of capital), and the Sharpe ratio is 0.8. Since I have applied the technique on only one industry group, diversification is limited and therefore the Sharpe ratio is low. For the interested readers, they can attempt to apply this technique to more industry groups and perhaps generate a higher Sharpe ratio. Even with just one industry group, this trading strategy may be a good complement to a portfolio heavy on trend-following strategies and therefore require a reversal model to smooth out the returns.

I have started a model portfolio in my subscription area to demonstrate this strategy which will be updated daily around 3pm ET. Other details of the strategy will be detailed in an accompanying article there as well.


18 comments:

  1. Excellent article! Data very well presented- I will need to take a class from your professor :)

    ReplyDelete
  2. Hi Ernie

    Thanks for the interesting post, as ever.

    I have never personally seen an example of a pairs trading model that also uses a factor model. I find this curious since I would have thought a factor model would - or could - be a natural extension of a pairs trading model in a number of ways. (I use the term ‘factor model’ generally to describe a regression-based approach.)

    The main problem obviously with a pairs trade is that the individual stocks may no longer be so closely tied together along fundamental grounds. In the standard approaches (e.g. using cointegration techniques applied to individual price data alone), this is often not picked up if the reason for divergent fundamental trajectories is fairly recent.

    However, there are many ways to potentially capture the relationship in the fundamentals of two stocks which could possibly reduce the number of failed trades that are entered into. For instance, the ratio of the median target price of stock A over stock B, the median expected EPS of stock A over stock B, a change in the level of consensus ratings for Stock A minus that for stock B, etc. These are possible factors based just on analyst estimates but there are other dimensions that could be explored using actuals/fundamentals.

    At the simplest level, a trade could be entered into if (A) it passed the standard cointegration test, and (B) there was no recent evidence of divergence at the fundamental level according to, for example, one of the metrics above. Essentially, step (B) would act as a simple, bivariate filter.

    A more robust method would be to construct a factor model to substitute for the filter described in step (B). The estimation sample would consist of all pairs of stocks that passed the first step, the spread between the two stocks would be the dependent variable and the right-hand-side variables to be tested are simply the type of factors described above.

    Technically, there will be some relatively minor issues to be thought about e.g. the distribution of the dependent variable is likely to be far from normal. So perhaps to begin with, a simple binary dependent varialbe model could be estimated – a probit or logit – capturing whether the spread converged or not. The approach could also be developed further into a single estimation framework through a joint estimation procedure. However, I think this is probably an unnecessary step (it looses much in parsomony) And there would be plenty of mileage to be gained in developing a more simple factor model to represent step B.

    Moreover, I think factor models could also be usefully employed to facilitate decisions about trade exits, not just trade entries. For instance, a trade could be unwound if evidence of divergence in fundamentals comes about post-entry. In building the factor model, the estimation sample would be all possible trades that have a positive signal (by whatever method), the dependent variable is again the spread between the two stocks and the right hand side variables are similar types of factors described above. (Technically, this would probably be some type of duration model so the duration of the trade could be explicitly allowed for; it might be, for instance, that spreads that fail to converge immediately are less likely to converge at all and this information should ideally be incorporated into the model.)

    Anyway, my main point is that I think factor models could play a very useful part in a pairs trading set-up. I intend to research some of these ideas myself (when time permits!). But your thoughts would be welcome. As I said, I am surprised that I have never come across examples of factor models in the context of pairs trading. Perhaps I’m missing something?!

    JR

    ReplyDelete
  3. Hi Yaser,
    Thanks for your compliments!
    Ernie

    ReplyDelete
  4. Hi JR,

    Thank you for your excellent comments! Indeed, imposing factor models on top of a purely technical cointegration model could improve the pair-trading model considerably. Indeed, if a factor model determines that there is a recent drastic change in the fundamentals, we should eliminate the pair from entry, or exit a pair that has an existing position. Many pair-traders perform this filter and/or stop manually, based on their reading of the news on those stocks. But clearly, a more systematic/automated approach using factor model would help, but perhaps not eliminate the need for human filtering of the economic situation.
    Ernie

    ReplyDelete
  5. To counter the thoughts above that somehow combining factor models with pairs trading would be a novel thing to do: a well-known (albeit pretty terrible) book about pairs trading by Ganapathy Vidyamurthy considers factor models.

    In fact, Vidyamurthy uses factor loadings to define a distance measure between instruments that is further used to filter for potential pair candidates.

    (I should also point out that Vidyamurthy applies cointegration techniques to pairs trading, so that's not novel either).

    Cheers,
    L.

    ReplyDelete
  6. Dear L,

    You are right that neither factor models nor applying cointegration methods to pair trading are new -- I have read articles about such applications years ago.

    My intention here is (partly) to show how such models have performed in the last 7 years as more and more traders adopted them.

    Ernie

    ReplyDelete
  7. I've been trading pairs for only about two months now, but have been rather unsuccessful so far. I've been following statistically proven methods and have a solid entry and exit strategy established to limit the behavioral impact on my results. Over the last two months I've entered into about 8-9 pairs of which only half have worked out to date.
    With such a small sample size it's possible that I've simply run upon some bad luck but I have noticed one potentially interesting phenomenon. It seems that my pairs naturally under-perform the market on days when the market is in positive territory. When the market drops, I tend to do pretty well. Again, this can't be statistically confirmed with such a small sample size, but I'm very tempted to place blame on a well known principle, particularly well known for swing/trend traders.
    History has shown that stocks that are performing well usually continue to perform well even when they're already well past their fair value. Same goes for stocks which are performing poorly; once they're on a downward trend they tend to maintain this trend.
    Seeing how the entire basis of pairs trading is acquiring a long position in a relatively under-performing stock and a short position in a relatively out-performing stock, the pair strategy seems to be magnifying this effect.
    In a market that's relatively oversold according to recent historical data it doesn't surprise me that this effect stands out when the market is having a good day, but doesn't tend to show up on a bad day. After all, it seems that Wall Street is desperately over optimistic considering the economic conditions we face.
    Perhaps I will slightly modify my technique by entering a pair position only if both stocks are trending in the same direction, one just more so than the other. Naturally I've also been taking a good look at the fundamentals when entering a pair as well as mention worthy news concerning the firms, which is why I'm placing so much emphasis on momentum.
    Am I the only one that seems to be noticing this disturbing trend?

    ReplyDelete
  8. David:
    You said "History has shown that stocks that are performing well usually continue to perform well even when they're already well past their fair value. Same goes for stocks which are performing poorly; once they're on a downward trend they tend to maintain this trend."

    I believe stocks are trending only when there is a news event which alter their expected valuation. You can avoid such trending stocks by eliminating those that experienced such events recently, then your remaining pairs should exhibit more mean-reverting behavior.

    Ernie

    ReplyDelete
  9. Yes, I agree with you on the fact that momentum is often due to a news event.
    But take MON, MOS, and SYT for example. All in the fertilizer business, and granted they'll realize a lot of business in the form of global demand for their products, their momentum runs on more than the occasional news item. Just like the internet bubble, real estate, and now arguably oil. Once they heat up nobody wants to be left out and momentum remains for longer than it should. As for the down side, Warren Buffet has practically made all of his fortune off of oversold stocks, not all because the businesses weren't doing well, but because they were out of favor.
    Look at it this way; if you're holding a stock that's on fire, would you sell on the way up or wait for significant signs of weakness? How about a stock that's been trending down for 3 months, do you buy when there's no bottom or resistance showing? Probably not. Granted many buy and hold investors might, but they're in the minority.

    While we're on the topic of market neutral strategies on this blog, take a look at the following link which emphasizes a strategy similar to pairs trading but using the momentum we've been speaking of.
    http://www.nytimes.com/2005/06/05/magazine/05HEDGE.html?ei=5090&en=2752ba8f8091401a&ex=1275624000&partner=rssuserland&emc=rss&pagewanted=all

    As many analysts and academia tend to point out, stocks do generally accurately portray the information regarding their current and future performance and market value (efficient market hypothesis). However, this is only true over the long run while lulls and frenzies often create gross imbalances.

    Just curious; are you personally employing a pairs trading strategy and if so, are you doing well with it?


    Thanks for your feedback, it's much enjoyed.

    David

    ReplyDelete
  10. David,
    Generally I trade mean-reverting strategies, whether in pairs or singles. I have expressed my view elsewhere on this blog that markets are mean-reverting most of the time, except immediately after news events.

    The type of pairs I trade are actually discussed in details on this blog too. They are mostly commodities ETF's.

    And they are consistently profitable.

    Thanks for your interest!
    Ernie

    ReplyDelete
  11. Hello Ernie!

    On pages 44-45 of your book, you discuss annualizing trading periods in order calculate an Annualized Sharpe Ratio.

    This question if for those of us that are not very adept with Matlab yet...

    Let's say we've backtested a strategy over 2 years of data and it had x roundtrip trades over that period, although we don't know precisely when they occurred during that 2-year period.

    Would we use 0.5 as Nt (i.e., the number of trading periods there are in a year) since we're talking about a 2 year period?

    Any suggestions are appreciated.

    Thanks!

    ReplyDelete
  12. Jacques,
    It seems to me you are referring to a strategy that holds positions overnight. In that case, Nt should be 252 (no. of trading days in a year).
    Best,
    Ernie

    ReplyDelete
  13. Very interesing article. The pairs trading model seems intresting but more and more traders see the profits dimish and turn into losses.

    ReplyDelete
  14. As well as performing quantitative analysis you need to perform qualitative analysis on the stocks within a pair, it's not enough to just rely on technicals, if a pair is showing high correlation and co-integration you still need to watch for individual news items on the stocks, for example if one stock released shocking earnings announcements sending the stock plummeting 20%, you should avoid trading this stock no matter what the technicals say, analyzing the news is part of any good pair trading system.

    ReplyDelete
  15. Jared,
    I agree with you completely on the importance of news on pair trading stocks. That's why I focus on trading ETF's instead, to avoid this trouble!
    Ernie

    ReplyDelete
  16. Hi, please let me know what you think of this Pair Trading strategy where you trade based on when one stock may outperform another on a certain day. There is a really cool Excel tool to support automating the analysis behind this new day trading or pair trading strategy -

    http://www.youtube.com/watch?v=r-8QNBxiGyo

    ReplyDelete
  17. Hi Shaun,
    Thanks for the video. I find there may be insufficient statistical evidence to justify that type of seasonal pair trading rules. I suggest you backtest the strategy using 3 - 5 years data before trading it live.
    Ernie

    ReplyDelete
  18. Interesting discussion!
    The new approach to basket trading can be combining fundamental analysis and quantitative approach.
    One can think of applying cluster analysis to identify the basket of fundamentally similar stocks and then perform unit root tests.

    The other issue is estimation of cointegrated regression. Some argue that the next step in pair trading is nonlinear estimation. Eg. you can optimize (minimize) t-statistics of DF unit root test and you obtain different betas.

    ReplyDelete