Saturday, October 06, 2007
How a mean-reversion strategy performed in August
Prof. Andrew Lo and Mr. Amir Khandani at MIT recently wrote a paper on "What Happened To The Quants In August 2007?" (Hat tip to my reader Mr. J. Rigg for the article). Most of their conclusions confirm what many observers already suspected: that the loss is likely due to the simultaneous forced liquidation of portfolios holding similar positions by various quantitative funds. What is noteworthy, however, is that they constructed a mean-reversion strategy and observed what happened to it during August. This strategy is very simple: buy the stocks with the worst previous 1-day returns, and short the ones with the best previous 1-day returns. Despite its utter simplicity, this strategy has had great performance since 1995, ignoring transaction costs. The Sharpe ratio was an astounding 53.87 in 1995, gradually decreasing to 4.47 in 2006. However, the strategy also had a disastrous few days on August 7-9, suffering a cumulative (arithmetic) return of -6.85% in those 3 days. Then on August 10, it rebounded, like the rest of the quant funds, with a return of 5.92%, almost reversing all of its previous losses. For me, this experiment reveals three interesting points: 1) a simple price factor seems to capture most of the performance of the complex factor models run by the gigantic hedge funds; 2) even technical mean-reverting factors suffer losses, not just momentum (growth) factors based on fundamentals; and 3) if one wants to avoid disasters and enjoy spectacular returns, even a one-day holding period is too long. I haven't done the experiment myself yet, but I bet that if we were to liquidate the portfolio at market close each day, not only would we avoid the loss of -6.85% in those 3 days, but would probably end up with a positive return of a similar magnitude!
Dott.Chan this isa great blog that I read every time I can.
ReplyDeleteYou often talk of intradaily sistems taht are the best and now again you write of close the trades daily.
Could you explane how you realize
a simple intraday trading sistem?
Statistical Mean reverting for ex.?
I read that the gains are made on overnight overall...
thanks!
Dear Anonymous,
ReplyDeleteAn example intraday trading system is just as I described in this article -- a simple variation of Prof. Lo's mean-reverting strategy. Instead of updating the portfolio at each day's close and carrying the positions overnight, you can update the portfolio at each day's open and exit all the positions at the close.
Ernie
It's quite insteresting that the most simple models seems to be the most powerful. Most financial models have very simply forms. I also confirm this from my owe experience. At first I tried to design complex models to forecast price movements, but failed. Then I reduced factors to include only price: the model works very well now: it can be applied to every market (equity,currency,future,commodities).
ReplyDeletejohntrend@yahoo.ca
John,
ReplyDeleteThat's exactly my experience too.
Ernie
I think your conclusions in this post are completely wrong... How do you justify them? The fact that some strategies make money before transactions costs does not mean that they explain strategies that make money after transaction costs!!
ReplyDeleteDear Anonymous,
ReplyDelete1) I think your argument is mainly with Prof. Lo. I simply paraphrased his conclusions.
2) Strategies that trade highly liquid stocks (such as the midcap stocks in Prof. Lo's study) at most twice a day (once, in Prof. Lo's study; twice, in my suggestion) do not suffer so much impact from transaction costs that would render them unprofitable. This is both from my own theoretical studies as well as actual trading experience.
3) The point of Prof. Lo's study is not the exact magnitude of the daily returns, which would of course be lowered by the introduction of transaction costs. The point is the sign of the returns, which as I argued above, is unlikely to be changed here.
Ernie
I had a done a similar thing but on the long term. I invested in the long term for companies who did well one day and companies who did poorly one day.
ReplyDeleteOver 1.5 years my returns were 50% and 13% respectively. That 13% would be wiped out by all the fees I would've had to pay. Where as that 50% would've been ok. I don't know the current valuation in the current economy.
Hi, I think mean-reversion system is paired with huge intraday drawdown and that can NOT be avoided. If you use a tight, fixed stop loss for mean-reversion, the performance will be dramatically reduced. For a trend following system, the stop loss can be tight as 1 ATR without affecting performance much. But for mean-reversion system, the stop loss need to be at least 3 times ATR or most of cases higher. I think the huge drawdown is the cost to have a high winning percentage and you can't get the best from both world.
ReplyDeleteErnie
ReplyDelete1.) When is your next work shop in the US?
2.) Does this basket if stocks he is buying and selling have to be correlated or cointegrated?
3.) Does your book highlight things that will give me direction on finding mean reverting strategies?
Hi Maurice,
ReplyDelete1) My next online Mean Reversion Strategies workshop will be on July 29 and Aug 5, 9am-12pm New York time. Please see http://www.epchan.com/workshops/ for details.
2) No, the basket in this article does not have to be cointegrating, or even correlated. However, each individual stock is definitely correlated with the average return of the basket. This correlation is often called "beta".
3) Sure, my second book in particular discuss many different implementation of mean reversion strategies. And my course in 1) discussed a different set of such strategies.
Ernie
Thank you for your reply Ernie, this blog is and filled with nuggets!
ReplyDeleteThank you for the responses above Ernie.
ReplyDeleteThanks to your blog I was able to fix my FX mean reversion strategy by removing my stop loss last night. GBPUSD and USDCHF worked out very well 2015 forward in back and forward testing. (1 Hour Candles) Then it dawned on me today that the daily swap charges in FX render this strategy useless....
Now i am back to the drawing board after working on this thing for about 3 months.
I want to focus on currencies because the leverage allows me to make larger profits then stocks or futures. (I don't have 25k to play with) I understand that leverage can be dangerous so i will be sure to manage the risk of my portfolio.
Do you have any links or strategies for intraday FX strategies. Mean Reverting or Momentum
1.) I just purchased your book today which has given me some great ideas.
2.) I found the London Breakout Strategy while digging through your blog today, I will review that and implement it
3.) The Ultimate Trading Robot - This price seems ridiculous at 650 bucks but if i have to buy it I will.
4.) Does your class focus on mean reverting stock strategies? If i enroll will i be able to implement any of it in the currency markets immediately after the class?
5.) Any other thoughts or direction you can give. I'm determined to make this happen if it takes me days, nights, and weekends for the next 10 years.
Thank you for the responses above Ernie.
ReplyDeleteThanks to your blog I was able to fix my FX mean reversion strategy by removing my stop loss last night. GBPUSD and USDCHF worked out very well 2015 forward in back and forward testing. (1 Hour Candles) Then it dawned on me today that the daily swap charges in FX render this strategy useless....
Now i am back to the drawing board after working on this thing for about 3 months.
I want to focus on currencies because the leverage allows me to make larger profits then stocks or futures. (I don't have 25k to play with) I understand that leverage can be dangerous so i will be sure to manage the risk of my portfolio.
Do you have any links or strategies for intraday FX strategies. Mean Reverting or Momentum
1.) I just purchased your book today which has given me some great ideas.
2.) I found the London Breakout Strategy while digging through your blog today, I will review that and implement it
3.) The Ultimate Trading Robot - This price seems ridiculous at 650 bucks but if i have to buy it I will.
4.) Does your class focus on mean reverting stock strategies? If i enroll will i be able to implement any of it in the currency markets immediately after the class?
5.) Any other thoughts or direction you can give. I'm determined to make this happen if it takes me days, nights, and weekends for the next 10 years.
Thank you for the responses above Ernie.
ReplyDeleteThanks to your blog I was able to fix my FX mean reversion strategy by removing my stop loss last night. GBPUSD and USDCHF worked out very well 2015 forward in back and forward testing. (1 Hour Candles) Then it dawned on me today that the daily swap charges in FX render this strategy useless....
Now i am back to the drawing board after working on this thing for about 3 months.
I want to focus on currencies because the leverage allows me to make larger profits then stocks or futures. (I don't have 25k to play with) I understand that leverage can be dangerous so i will be sure to manage the risk of my portfolio.
Do you have any links or strategies for intraday FX strategies. Mean Reverting or Momentum
1.) I just purchased your book today which has given me some great ideas.
2.) I found the London Breakout Strategy while digging through your blog today, I will review that and implement it
3.) The Ultimate Trading Robot - This price seems ridiculous at 650 bucks but if i have to buy it I will.
4.) Does your class focus on mean reverting stock strategies? If i enroll will i be able to implement any of it in the currency markets immediately after the class?
5.) Any other thoughts or direction you can give. I'm determined to make this happen if it takes me days, nights, and weekends for the next 10 years.
Hi Maurice,
ReplyDeleteHere is a paper on intraday momentum trading: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2198816
Here one that is a mixture: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2419243
I haven't used Ultimate Trading Robot myself - no endorsement is implied by my shoutout.
My Mean Reversion Strategies course does include discussions of FX and Futures, but mean reversion is most frequently observed in equities/ETFs. However, the techniques discussed are applicable to any markets.
If you backtest enough strategies, either inspired by books, blogs, or published papers, and strive to improve on them based on your own backtests, sooner or later you will find one that works. I have seen that happened with many of my students.
Ernie
Ok thanks!
ReplyDeleteErnie, I now have a list of about 10 strategies lined up to code and test.
ReplyDeleteThe first one is a intraday mean reverting strategy that I noticed by observing currency pairs last night. I will be testing for cointegration using the steps outlined in your book but I have no idea how much data I should use for a valid test.
Would this be based on a multiple of half lives if the pair is proven to be stationary or and arbitrary 2 weeks of 15 minutes data? What are your thoughts?
Maurice,
ReplyDeleteYes, multiples of half life would be a reasonable measure. I suggest at least 100.
Ernie
Ernie, do you have any references to position sizing? I have a strategy that is consistently 60% accurate but is flat in returns year over year.
ReplyDeleteI'm trying to figure out how to raise and lower my position size depending on some statistic or market condition that tells me there is a slightly better chance the market will go up or down tomorrow.
I have tried a trail stop but the returns are mixed and not consistent enough to put in a live environment.
I may have just figured out the answer. This is probably why your book says trade baskets of the top 10 best performing and the top 10 underperforming so that I am more likely to get something that reverts and doesn't continue to trend.
ReplyDeleteErnie, thank you for constantly replying to all of my questions. I really appreciate it.
ReplyDeleteMy first strategy is ready to go live on 5 pairs now i'm working on my second.
1.) I merged your example of a bollinger strategy with one i found on youtube. The thing that makes the strategy work is the fact that the trades are not closed until at least one of the trades are in profit.
Example: Sell when price is above upper band, average up as price moves up. When price hits the average only sell if one trade is in profit, if one trade is not in profit continue to hold until one trade is in profit then sell.
This seems like a huge risk... On the other hand I could see doing this on stationary only pairs...
What are your thoughts?
Hi Maurice,
ReplyDeleteYes, this approach would only work for pairs that are truly stationary. If there is an extended period where the prices deviate from the reference price, you will be stuck.
Ernie
Ernie, I have abandoned attempts to trade time unpaired time series, it seems i have strategies that will work great for 2 or 3 years then as you said "i get stuck" and experience a YUGE drawdown.
ReplyDeleteQuestion - I did some quick co integration (2 series) tests and find p values of 8%, i understand that you can only reject the null hypothesis with less than 5%. Would you take a swing at trying a strategy that is at 8%, doesn't seem that far.
When i use the Johansen i get much better eigenvalues for 3 series but i don't understand how to trade 3 pairs just yet, still working on rapping my mind around that.
Maurice,
ReplyDeleteSure, rejection of null at 8% is good enough for trading.
Ernie
Ernie, another question for you.
ReplyDeleteSteps taken
1.) I have found 2 cointegrated pairs using CADF test in Gretl
2.) I have created a program to trade it
Problem
1.) I am using the spread = PairA - (HedgeRatio*PairB) with bollinger bands to enter trades.
1a.) I don't understand how to tell which pair to go long and which pair to go short.
The best results have been when i always go long PairA and always go short PairB but that works well from 2010 - 2013 but completely falls apart in 2014 and gives mediocre gains 2015 forward.
Questions
1.) How do I know which pair to go long and which pair to go short? I don't understand how to do this using the spread formula.
2.) What steps would you take to figure out why the strategy completely fell apart in 2014. The pairs were still co integrated during that time.
Maurice,
ReplyDeleteIf spread hits the lower band, long A short B.
If spread hits upper band, short A long B.
If it remains cointegrated but strategy is unprofitable, that means your trading parameters do not suit that period. For e.g. if half life is very long, but the lookback period of your Bollinger band is too short, it won't be profitable.
Ernie
OK thanks I get that now.
ReplyDeleteI have my half life, good bollinger period, cointegration, linear regression determining my hedge ratio ect (will do this until i get Gretl or Matlab integrated into my program)
These settings only work is specified periods in history, i assume to ensure they work in all application mean reverting periods the variables would need to be dynamic.
1.) Is this a correct assumption?
2.) How often should I update the half life and check co-integration? Is it something i need to code into my program daily to red flag me if each hit some unreasonable threshold?
3.) Should I have the program dynamically run tests and update the half life, hedge ratio, ect. as long as they stay cointegrated?
Maurice,
ReplyDelete1) Yes, optimal parameters do indeed change over time.
2) Monthly should be fine.
3) Sure, that would be systematic.
Ernie
Ernie how would you measure a divergence quantitatively?
ReplyDeleteExample: A stock makes a double top or head and shoulders but a technical indicator like RSI divergences at those points. I'm not sure how to tell programmatically when the mins and maxes of the double top and head and shoulders actually happen.
Maurice,
ReplyDeleteI am not a technical analyst, and am not a big fan of "double top" and "head and shoulders". So I am afraid I can't help you there.
Ernie