Monday, January 30, 2012

What worked in 2011?

We all know that 2011 was a bad year for many hedge funds, with the average fund down 5%. But what type of strategies did well, and what did particularly poorly? The numbers are out: Forex funds lose more than average, down 6%. In fact, 71 out of 77 Forex funds tracked by a Citigroup currency analyst were down in 2011. And the winners are? Statarb funds, with a 5% averge return.

This superior performance of statarb funds is quite a contrast from the last financial crisis 2007-9. Then, most of the big factor-driven statarb models failed miserably. What caused this difference? Is it because the risk management techniques of big funds have improved? Or maybe that's because in 2011, the deviation from factor returns mean-revert within a few days, so those statarb models that re-balance on a daily basis can benefit from the buying/selling opportunity at steep discount/premium?

To settle this question, let me report the 2011 backtest results (without transaction costs) of running Andrew Lo's prototype mean-reversion model : ranking stocks based on their previous day's returns, shorting the top decile and buying the bottom one, rebalancing only at the close. (Click on chart to make it larger.)



The APR in 2011 was 18.6%. Note in particular its performance since the crisis began officially on 20110808: despite a steep drawdown, the overall performance was spectacular! Clearly, high volatility benefited a prototypical statarb strategy, and the out-performance has not much to do with improved risk management.

You might wonder what would happen if we had used the intraday version of this strategy instead: enter all positions at the open, and exit them all at the close? I tried it: the performance is surprisingly similar to the interday strategy. So intraday vs. interday volatility or mean-reversion does not seem to play a part in last year's equities market. Contrasting this with the performance of Forex models, it is clear that high volatilities benefited statarb models while they hurt FX models.

In the next article or two, I will explore the 2011 performance of some other equities mean-reverting models that I used to trade. But what about your models? If you have some thoughts on what worked and what didn't in 2011, please share them with us in the comments section.

47 comments:

Anonymous said...

Thanks for a great blog.

The return on Andrew Lo's strategy is primarily driven by small caps. Was this the case also in 2011.

Thanks,
Hank

Ernie Chan said...

Hank,
Good point. I should clarify that I am using the SP500 universe for this backtest, so small caps are not involved.
Ernie

pnath01 said...

.I have one question.For a given stock in a given time how often is occurence of M size move compared to 2M size move.My studies over 20 years conclude that M size move should be 4 times more common than 2M size move---based on square root of time principal for option pricing/odds of move of a given size in the underlying in the BLACK SCHOLES formula. BLACK SCHOLES may not be perfect--but the fact remains that trillion dollars of derivatives are traded each day based on this formula & option market makers make money year after year & laugh all the way to the BANK.Similar to relationship between price of one month option versus price of 4 month option,If it takes one month to get M move, it would take 4 months for 2M move in the same stock in the same time period.This tells me that if human brain is kept out of the equation & in SYSTAMATIC(automated) investing in stocks, take profit be 1/2 the size of stop loss( & we already know that markets are RANDOM) then over thosands of RUNS investor shall make a whole lot of money.Out of four trials one makes one dollar 3 times & loses 2 dollars one time with net profit of one dollar--all one has to do is that when take profit is HIT, cancell the unfilled stop loss order & repeat the process over & over.Investor stays direction neutral at all times with no bias long/short.This is not just a theoretical question--if you spend few hours pondering this question I bet your next 5 generations can make tons of money over the next 500 years,just clicking on the LAP TOP & would never have to look for A JOB.Any criticism would be appreciated.Thank you for your help in advance.
Dr Prem Nath MD cell# 845 641 6778 email indus68@gmail.com

Anonymous said...

Enjoy the blog.

Clearly the "Risk On/Risk Off" nature of the second half of 2011 caused a lot of mean reversion - mainly driven by European issues.

I wondered if you had any tools for detecting levels of mean reversion in an instrument (not a pair)?

Thanks,

David

Anonymous said...

Can you please post a more meaningful backtest of at least 7-10 years? Since you already have the code and platform it should be just a matter of a few clicks? I would greatly appreciate it.

Many thanks

Ernie Chan said...

Dr. Nath,
You have made some interesting observations here. However, the system you proposed has assumed both mean-reversion and a near-normal distribution of returns. If the system is truly a random walk, there is equal chance that the next move is a loss vs a profit. So 50% of the time you will not have the chance to take profits, even if we assume the move is never larger than 1M.
Ernie

Ernie Chan said...

David,
By detecting "levels" of mean-reversion, I assume you mean whether it will mean-revert, and how fast?
If so, you can look up the Ornstein-Uhlenbeck formula for half-life determination, in google, in my book, or in this blog. If half-life is negative, it means there is no mean-reversion.
Ernie

Ernie Chan said...

Anon,
For the performance of the model over a longer horizon with older data, you can just read Dr. Lo's original paper. My research here is just to report the most recent update of his model. I unfortunately don't subscribe to 7 years old data!
Ernie

George said...

Since retail traders' edge is totally different from the institutions, which include hedge funds, do you think it makes sense for the retail traders to mimic institutions' strategies ? If not, then the strategies adopted by the institution are irrelevant to the retail traders, don't you think ?

Ernie Chan said...

George,
I don't think retail traders should mimic institutional strategies, but retail traders can still get some inspiration or ideas from strategies that hedge funds use.

Even though the strategies are not identical, there may also be significant correlations between their returns. So I find it useful as a diagnostic tool to find out whether a drawdown in my own strategies are common among the same category of strategies. If so, I won't be too worried. If not, then maybe I am doing something especially wrong.

Ernie

Anonymous said...

Hi Ernie:

I liked your book and have read your blog for a long time. I was curious about your results for this strategy as I've read the paper you got it from and tested variations of it in the past.

I attempted to duplicate your results on an intraday basis for the last quarter of 2011 (sort S&P 500 symbols by return at EOD; weight using individual performance vs average performance, scale by total weight; long bottom 50 and short top 50 the next day using open price, close out at close price; calculate return as sum of (scaled weights * symbol returns)) but got no where near the return you listed (mine was 5.4% vs what looks like the vast majority of your 18%+ return). Am I missing something? Would you be willing to share your output file with daily symbols/returns (or look at mine)?

I was also hoping you could clarify how the interday strategy works: does it rebalance at close each day (which would require guess work as to the symbols' final prices) or open and hold the positions overnight?

Thanks.

Ernie Chan said...

Hi Anon,
There is one difference between your intraday strategy and the one I tested: I rank the stocks using the return from previous close to today's open. Now you might argue that is unrealistic, because who can execute at the open without knowing the open prices? Two answers: you can use the pre-open prices as a proxy, or you can execute just after the open. Both cases will incur slippage, but we are ignoring transaction costs in general in this test anyway.

As for the interday strategy, I am executing using the closing prices, and holding the positions overnight.
Ernie

arienai said...

Ernie,

Interested to get your view on this & maybe relevant to the discussion

http://arxiv.org/pdf/1201.6655v1.pdf

To quote from the paper...

fractional Kelly can be seen as an experts
algorithm [2] with two experts: yourself and the market.
We propose dynamically updating according to standard
experts algorithm logic: When you're right, you increase
appropriately; when you're wrong, you decrease .

An interesting take on kelly - but also a suggestion on increasing allocation to systems when you're 'right' i.e. when the models are working like your stat arb systems in 2011.

Ernie Chan said...

Hi arienai,
Thanks for the reference. The paper looks interesting after a quick browse. But regarding "a suggestion on increasing allocation to systems when you're right" - Isn't that what standard Kelly criteria recommends?

Ernie

arienai said...

Ernie,

As I understand it the Kelly based allocation in your book is static in that it just uses a full history back test Sharpe to decide allocation weights.

This would be a more dynamic based Kelly weight allocation to a system that's currently 'right' i.e. one which has had good 2011 performance/sharpe.

Ernie Chan said...

arenai,
You are right, but only a small change is needed to increase allocation to a strategy that works: simply use a moving 1 or 3-year lookback period to compute the optimal allocations of each strategy, instead of using all the data from inception date.
Ernie

James said...

Very interesting blog post.

I work on an equity stat arb desk. We have 3 models and 6 sub-strategies that do intraday trading of equity pairs. They're all mean-reverting algos, but each model has a different way of calculating a spread's "fair value" and the deviation from the fair value that is required before it enters a position. Our best year by far was 2008. Last year was decent, but the vast majority of our pnl was during the highly volatile late july-early september period. The past few months have been very mediocre.

Ernie Chan said...

James,
Thanks for sharing. Yes, 2008 has been the best for our mean-reverting equities strategies too. The last 2 years have been mediocre.
Ernie

Anonymous said...

enjoy your blog and always informative.

Just wondering if you can recomment any book or web for learning Matlab?

Thanks

Howard

James said...

Ernest, one of the problems we've been having is sharp moves by a particular stock due to various news and events. If we're trading stock A vs B and a story breaks out about A being an acquisition target, A would spike up 5% within a short time frame, and our models would get short A and long B. We would instantly be down thousands of dollars, and although such a sharp move often leads to some reversal, the damage would be done by then. Do you think this is just one of the aspects of intraday stat arb trading that i have to deal with?

Alexey said...

James, I am looking at trading small mean-reverting portfolios of FX pairs which cointegrate briefly, i.e. intraday. I am still at backtests stage but this is what I noticed as well: this kind of mean reversion strategies do best in high to extreme volatility environments. So in my case I see fabulous performance in 2008. About half of that in 2011. But all the rest of time the performance is not enough to cover spreads and brokerage fees.

So my question now is: has anyone seen mean reverting strategies (and in which asset classes) which do good in average/low volatility environment?

Ernie Chan said...

Hi Howard,
Matlab.com offers many free webinars on how to use Matlab for financial applications. My book also contained an appendix on the basic usage of Matlab.
Ernie

Ernie Chan said...

James,
When we run statarb strategies, we have news alerts on stocks that we have orders or positions on. We manually check each news item to see if we should cancel the order or exit the position immediately.
Ernie

Alexey said...

Ernie,

I have a question for you. And actually anyone else trading mean-reversion. Let's say you have found stationary-looking portfolio. You can estimate it's OU parameters [mean, sigma, reversion speed]. So you see how far it is now from the mean. This gives you an idea as to whether short it or go long. Now my question is: where to put stop loss and take profit targets. Did anyone try to estimate it scientifically?

I am thinking along the following lines... What we have here is an option. If we put on a trade with stop loss and take profit and some time target after which we close it down (if it did not hit SL or TP.) This is a barrier american option. The strike is TP, the barrier is SL and the expiration is our time horizon.

So if we believe in our mean-reversion model and the parameters that we estimated for it then the only thing we need to do is to price that American Barrier option on that particular Ornstein-Uhlenbeck model.

Did anyone do it like this? It would be interesting to know if there is an analytic formula, like BS, in this case, or at least good analytic approximation. This will make it possible to maximize the value of the option by placing strike and barrier accordingly.

I have an idea as to how to price that option using monte-carlo (as we know the distribution of the spread if it follows OU) but this approach is waaaaaay to slow to be used in optimization.

Any ideas?

Ernie Chan said...

Alexey,
Whether a strategy does well is more of a question of whether volatility is fairly constant, or whether it changes a lot. If it is fairly constant, you can always adapt your "Bollinger bands" to that volatility and be profitable. Alternately, you can also do that if you are very good at predicting volatility.
Ernie

Leigh said...

Howard and James,

Killing 2 birds with one stone (cointegration of symbols and learning MATLAB)...

Meucci tests cointegration on swaps in this paper: http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1404905
Also, the matlab code and data can be found here: http://www.mathworks.com/matlabcentral/fileexchange/24120-review-of-statistical-arbitrage-cointegration-and-multivariate-ornstein-uhlenbeck

That way you can figure out which symbols cointegrate and learn MATLAB at the same time. Just don't steal all of the alpha...

Leigh said...

Sorry, meant for anonymous and Alexey... Need to check my comments

Leigh said...

Alexey,

As far as your comment:
"It would be interesting to know if there is an analytic formula, like BS, in this case, or at least good analytic approximation. This will make it possible to maximize the value of the option by placing strike and barrier accordingly. ...I have an idea as to how to price that option using monte-carlo (as we know the distribution of the spread if it follows OU) but this approach is waaaaaay to slow to be used in optimization."

Have you tried variance reduction techniques and low discrepany sequences? How about finite difference methods?

Ernie Chan said...

Alexey,
I have never found that imposing a stoploss in the backtest of a mean-reverting strategy is helpful to its returns or Sharpe. Have you found otherwise? (See also my discussion here: http://epchan.blogspot.com/2011/09/stop-loss-profit-cap-survivorship-bias.html)
Ernie

R.D. said...

I did a similar mean reversion backtest. Over 500 stocks, normalized for price and volume, both absolute value and standard deviation. Looking at zones of price and volume on day n to predict what would happen on day n+1. Winning (long)trades have a modest to large negative delta price with a modest volume. Enter with a limit order, typically down from the previous close by about 1%, exit at the close. At first it looked great, lots of winning trades, excelent per trade expectancy, etc. Then I looked at the equity curve and found most of the good trades were on the same few days throughout the year. You can salvage the strategy to some degree by only taking trades when more than 10% of the stocks in the model give a buy signal, but it's hard to make much money when there are only a few days like that. The good news is it has lots of carrying capacity on those few days.

Ernie Chan said...

R.D.,
Yes, we also found from our equity reversal strategies that they mostly make money on a few highly volatile days. That's why the H2 of 2010 - H1 of 2011 weren't good times for those strategies.
Ernie

Anonymous said...

Hi, Erine, I am a new to your web site and new to quantitative trading (I have not started). I have a couple questions I can't find answer anywhere and hope that you could point me to some resource?

First question is when you mentioned optimization, do you optimize your system against just one specific market? I backtested my 'system' against 30 common ETFs, SPY, GLD, EW*, XL*, and etc. Some 'system' do okay/well in 80% of the markets and small damage to the remaining markets; some 'system' result wide range of numbers. Does that matter?

My second question is how often you retest your system? I mean market regime changes, market move faster/slower and need new ema period, and etc? Do you wait until lost pile up? What trigger a retest? What trigger a 'back-to-the-drawing-board' event?

Thanks,

Sink

Ernie Chan said...

Hi Sink,
I recommend against optimizing your parameters for each specific market, since the limited historical data can easily lead to data snooping bias. One set of parameters should work for all markets, even though they may not be optimal for some.

Whenever a drawdown is steeper than the max drawdown in backtest, or a drawdown duration is longer than the max drawdown duration, it is time to study the model again to see what whether we have overlooked some weakness.

Ernie

Anonymous said...

Ernie, thanks for the quick response. How many markets should I consider testing? Should they be related, or should they be unrelated? For example, (EWC, EWA) being related, (EWH, FXI) too. (SPY, TLT, IYR) are more or less not correlated?

Thanks,

Sink

Ernie Chan said...

Sink,
You can consider as many markets as you like, but when you find good results in pairs of markets that make no fundamental sense, you have to make sure that the results are not spurious (e.g. due to some coincident market events that may not repeat).
Ernie

Anonymous said...

Hi Ernie,

Must say a good blog. Well for mean reversion strategies, one of the tthings to be careful is the fact that most of the funds/traders are probably looking at the same pairs, thus it produces a "crowded trade" effect. So when things get ugly, you'll see that everyone will be on the same side unwinding...and on the upside, you'll need to have more leverage to make the "returns" look attractive. If you can backtest your strategy inclusive of transaction cost and still get great unlevered returns (+10%), then probably you can conclude in some certainty that it is not a "crowded portfolio".

I have basically traded mean reverting pairs in Asia Pacific. have not done so in EU or US. But i can confirm that 2008 was indeed a fabulous year.If i have stuck to the model, i would have made circa 35-45% unlevered, but as i did not have the guts to go for it, i manually put on trades less than 50% of what the model said, it was like close to +15% for me. First half of 2009 was good as well. Returns in 2010 and 2011 was positive but low single digits.

The tsunami in Japan did increased the volatility thus mean reverting pairs actually booked a very profitable 6-7 months after the tsunami. However if you are long TEPCO it would have hurt. (which incidentally i did..and shorted another power company)..however this is a random event as it could have happened to a power company that i have shorted and could have made tonnes of money on it.

I have recently moved out of the place i was working at. i have a question ernie, (if i understand correctly that you are trading on your own now)

which brokers are you going through to get borrows to short and also provides competitive brokerage fees? anyone that provides leverage for you?


I am thinking of possibly trading on my own, however, not with a substantial capital. Circo 300k to start with. Possibly levered 3-4 times.

Ernie Chan said...

Hi Anon,
Good to hear that pair trading stocks continues to be profitable in Asia!

Would you buy a stock like TEPCO even after fundamentally bad news? Are you not afraid that the fundamental news affected the fundamental valuation of a company so that the price moves to a new equilibrium price and not likely to revert to its previous equilibrium?

Incidentally, Andrew Lo specifically used this mean-reverting strategy to illustrate the "crowd trading" effect you alluded to. I have also elaborated on the connection between mean-reversion, "contagion effect", and Kelly formula in my book, using this same strategy.

Interactive Brokers provided both stock loans and margin to me currently. Previously, I used Lime Brokerage, with Goldman Sachs as the stock loan and margin provider. I heard, however, that Fidelity Prime Brokerage has the best stock loan availability. (I mention Lime, Goldman, and Fidelity because I use them for my fund, not for personal trading.)
Ernie

Alexey said...

Leigh,

no, I do not want to look at monte carlo at all, variance reduction or not. It would be just way to slow. same for finite differences.

But what I have found is this:

ftp://ftp.math.ethz.ch/risklab/papers/den_ou.pdf

and this

http://statistik.ets.kit.edu/download/doc_secure1/ptem342v144techreport.pdf

which uses the first result.
I'll try to use this approach.

Ernie,

I understand what you say about stop losses being unnecessary for true mean reversion strategies. Unfortunately I cannot be sure my portfolios are true mean reverting portfolios. I use these results:

http://arxiv.org/abs/0708.3048

to search for 'least stationary' linear dependencies between two or three FX pairs for the timeframe several minutes to couple of hours. They are not guaranteed to be or remain mean-reverting. So I must have some idea when to stop and move on to next trade.

Anonymous said...

Hi Ernie,

Thanks for your response. will check out interactive brokers.

I had TEPCO on before the tsunami. Earthquakes did happen before but the blow-up of the pairs wasnt that bad the previous time.

After the tsunami i cut all power companies out in japan.

Anonymous said...

Hi Ernie

You mentioned in your article " 71 out of 77 Forex funds tracked by a Citigroup currency analyst were down in 2011"

Where I can find this information online?

Thx

Ernie Chan said...

Anon,
The currency funds info can be found at http://www.efinancialnews.com/story/2012-01-25/currency-funds-face-investor-ire

Ernie

Anonymous said...

Hi Erine

Have you ever applied Hidden Markov Chain technique on FX trading? Any good practical resource you can recommend ?

Thanks

Ernie Chan said...

Hi anon,
No, I haven't applied HMM to FX. I tried the technique on futures data before, but find that because there are so many parameters to optimize, it overfitted the data.
Ernie

Anonymous said...

Hi Erine

Could you please kindly recommend any source of reliable fx tick data,the only source I can get it for free is from gain capital, but i don't know how good is the quality, and its file format is not consistent

http://ratedata.gaincapital.com/

I heard onetick.com, but it seems to me it is more meant for institution investor rather than retail investor? How expensive of purchasing FX tick data from Reuters?

Thank You

Ernie Chan said...

Hi Anon,
I heard http://www.fxhistoricaldata.com provides free data.
You can also purchase from fxtickdata.com.
In fact, you can download 1 year's worth of intraday data free from Interactive Brokers if you are a customer.
The best data is that which come from your own broker, because FX has no centralized consolidated quote stream.
Ernie

Anonymous said...

Ernie,
when you use SP500 to backtest your strategies, how do you eliminate survivor's bias? because the SP500 companies you got in early 2012 are different from those at the beginning of 2011
thanks

Ernie Chan said...

Anon,
It is true that my data has survivorship bias. But hopefully a one-year backtest won't be affected by that too much.
Ernie