I'm excited to ask my first question here! I'll try to describe the mean-reversion strategy with some background, then explain what I couldn't understand.

The strategy is described in Earnest Chan's Algorithmic Trading, chapter 5, page 123.

Earlier in the chapter the author proposes a constant roll return pricing model for futures: $$F(t, T) = S(t)e^{\gamma(t-T)}$$, where S(t) is the spot price, t is current time, T is maturity time and $$\gamma$$ is the (annualized) roll return. Based on this model he observes that,

the log market value of a calendar spread portfolio with a long far contract and a short near contract is $$\gamma(T_1 - T_2)$$, where $$T_1.

This is because the log market value of a {-T1, T2} portfolio is $$logF_2-logF_1 = \gamma(t-T_2) - \gamma(t-T_1) = \gamma(T_1 - T_2)$$. For future reference a {T1, -T2} portfolio has the market value $$\gamma(T_2 - T_1)$$.

Now comes the strategy! It uses daily crude oil futures data from ~2004 to 2012. The roll return $$\gamma$$ was computed at each time using the first 5 contracts ($$\frac{\partial log(F)}{\partial T} = -\gamma$$). It's stationary from the ADF test (details omitted). Here's a time series of $$\gamma(t)$$: Using $$\gamma(t)$$, the author computes the z-score using some lookback window:

MA=gamma.rolling(lookback).mean()
MSTD=gamma.rolling(lookback).std()
zScore=(gamma-MA)/MSTD


He then picks a pair of contracts (far and near) on each day based on:

1. The holding period for each pair of contracts is 3 months
2. Roll forward to the next pair of contracts 10 days before the near contract expires
3. The far and near contracts are 1 year apart

These rules aren't relevant to my question, I've included them for completeness' sake.

Finally, the position size of the near/far contracts is determined as follows:

On days when the zscore > 0, hold a {$$T_1, -T_2$$} portfolio (i.e. long near, short far).

On days when the zscore < 0, hold a {$$-T_1,T_2$$} portfolio (i.e. short near, long far).

I'm confused about this rule. I thought when the zscore < 0, $$\gamma$$ will increase to revert to the mean. So this is when we want the portfolio market value to be $$\gamma(T_2 - T_1)$$, or $$\gamma$$ * (some positive number), so it can increase. This corresponds to a {$$T_1,-T_2$$} portfolio.

Any help in making sense of how he determines the position based on the zscore of $$\gamma(t)$$ is appreciated!

• You almost convinced me that you are right. But Ernest Chan's book is well regarded and it seems surprising to me that he would have a "sign error" in his reasoning. So after looking at your post for a while I am quite confused. Have any other readers of the book noticed a problem here? Jun 5 at 20:21
• Hi: Ernie is quite generous and responsive so I would ask him directly. He has a blog and his email is there. Jun 5 at 23:18
• @markleeds Thanks for the reminder! I've just emailed Dr. Chan and will update when he responds. Jun 6 at 14:09
• @noob2 I think I definitely missed something. If I swapped the position sizes to what I thought made sense, then the returns graph looks wrong. I've emailed him and will update here when he gets back to me. Jun 6 at 14:11

I sent Ernie an email with a link to this question and here is his response:

Yes, I agree with you that the strategy there actually is a momentum strategy, not a mean reversion strategy. In other words, if zScore < 0, we actually expect $$\gamma$$ to decrease further! The momentum strategy backtested is profitable.

I will note this in the 2nd edition of this book - thanks for pointing it out!

I then asked him why it's a momentum strategy when the ADF test on $$\gamma(t)$$ and its time series points to it being mean-reverting, he said:

The reason it is a momentum model is because the strategy can only be profitable if $$\gamma$$ decreases further once its zScore drops below zero. Over the long term, gamma can be stationary, but short term momentum does not preclude long-term stationarity.

• So it sounds to me like you're initial confusion was not confusion but rather that you were correct. The only way the positions described in Ernie's book make sense if one bets on the momentum of the $\gamma$ estimate rather than the reversion of the $\gamma$ estimate. Thanks for communication of his response. Now it makes sense to me. Jun 8 at 19:26
• Note that your second question to Ernie reminds me of why terms like "stationary" and "cointegrated" are so fuzzy. They very critically depend on the time frame that one is using to make decisions. This why people try to calculate things like the half life ( of a stationary model ) which is the time it takes for an initial shock to a stationary process to become half of what it was originally. Jun 8 at 22:43
• @mark great insight! mathematically, the half-life can be estimated using the regression coefficient, lambda, from the ADF test as -log(2)/lambda; the mean-reversion strategies in Ernie's book often uses it as the look-back length, although there's lookahead bias there. Jun 9 at 1:49
• Thanks Bill. Note that using some kind of half life estimate a good attempt for dealing with the actual time till reversion but these things are not easy to get good estimates of. You add another month worth's of data and who knows what happens to the new estimate !!!!!! But I'm pretty sure that that's what ernie is getting at when he mentions that there still can be momentum in a stationary variable. Jun 9 at 13:17