Monday, January 15, 2007

What is your stop loss strategy?

A reader recently asked me whether setting a stop loss for a trading strategy is a good idea. I am a big fan of setting stop loss, but there are certainly myriad views on this.

One of my former bosses didn't believe in stop loss: his argument is that the market does not care about your personal entry price, so your stop price may be somebody else’s entry point. So stop loss, to him, is irrational. Since he is running a portfolio with hundreds of positions, he doesn’t regard preserving capital in just one or a few specific positions to be important. Of course, if you are an individual trader with fewer than a hundred positions, preservation of capital becomes a lot more important, and so does stop loss.

Even if you are highly diversified and preservation of capital in specific positions is not important, are there situations where stop loss is rational? I certainly think that applies to trend-following strategies. Whenever you incur a big loss when you have a trend-following position, it ususally means that the latest entry signal is opposite to your original entry signal. In this case, better admit your mistake, close your position, and maybe even enter into the opposite side. (Sometimes I wish our politicians think this way.) On the other hand, if you employ a mean-reverting strategy, and instead of reverting, the market sticks to its original direction and causes you to lose money, does it mean you are wrong? Not necessarily: you could simply be too early. Indeed, many traders in this case will double up their position, since the latest entry signal in this case is in the same direction as the original one. This raises a question though: if incurring a big loss is not a good enough reason to surrender to the market, how would you ever decide if your mean-reverting model is wrong? Here I propose a stop loss criterion that looks at another dimension: time.

The simplest model one can apply to a mean-reverting process is the Ornstein-Uhlenbeck formula. As a concrete example, I will apply this model to the commodity ETF spreads I discussed before that I believe are mean-reverting (XLE-CL, GDX-GLD, EEM-IGE, and EWC-IGE). It is a simple model that says the next change in the spread is opposite in sign to the deviation of the spread from its long-term mean, with a magnitude that is proportional to the deviation. In our case, this proportionality constant θ can be estimated from a linear regression of the daily change of the spread versus the spread itself. Most importantly for us, if we solve this equation, we will find that the deviation from the mean exhibits an exponential decay towards zero, with the half-life of the decay equals ln(2)/θ. This half-life is an important number: it gives us an estimate of how long we should expect the spread to remain far from zero. If we enter into a mean-reverting position, and 3 or 4 half-life’s later the spread still has not reverted to zero, we have reason to believe that maybe the regime has changed, and our mean-reverting model may not be valid anymore (or at least, the spread may have acquired a new long-term mean.)

Let’s now apply this formula to our spreads and see what their half-life’s are. Fitting the daily change in spreads to the spread itself gives us:



These numbers do confirm my experience that the GDX-GLD spread is the best one for traders, as it reverts the fastest, while the XLE-CL spread is the most trying. If we arbitrarily decide that we will exit a spread once we have held it for 3 times the half-life, we have to hold the XLE-CL spread almost a calendar year before giving up. (Note that the half-life count only trading days.) And indeed, while I have entered and exited (profitably) the GDX-GLD spread several times since last summer, I am holding the XLE - QM (substituting QM for CL) spread for the 104th day!

(By the way, if you want to check the latest values of the 4 spreads I mentioned, you can subscribe to them at epchan.com/subscriptions.html for a nominal fee.)

18 Comments:

Anonymous Anonymous said...

Wondering if you could break down how the half life is calculated...?

Wednesday, April 18, 2007 3:56:00 PM EDT  
Blogger Ernie Chan said...

Hi,
See the Ornstein-Uhlenbeck formula at http://en.wikipedia.org/wiki/Ornstein-Uhlenbeck_process

If you believe the spread is mean-reverting, this formula will describe its time-evolution. You will notice that the time-evolution is governed by an exponential decay -- hence the notion of half-life.
Ernie

Wednesday, April 18, 2007 9:33:00 PM EDT  
Blogger Volat said...

Good article. One question: How do you use the estimated "theta" to trade? What is your trading strategy after the estimation? Do you still apply threshold rule to trade? Thanks

Tuesday, May 20, 2008 7:51:00 PM EDT  
Blogger Ernie Chan said...

Dear Volat,
The estimated half-life can be used to determine your maximum holding period. Of course, you can exit earlier if the spread exceeds your profit-cap.
Ernie

Tuesday, May 20, 2008 8:14:00 PM EDT  
Blogger Volat said...

I assume half-life means 1/2 of the time for the spread to revert to its mean. Therefore a half-life a 16 days means that it takes 32 days for the spread to revert to its mean (correct me if I am wrong). And with this number, you basically open the position at day 0 and close the position at day 32, then open the position at day 64, and then close the position at day 96...Is that right?

Tuesday, May 20, 2008 9:52:00 PM EDT  
Blogger Ernie Chan said...

Volat: Yes, that's right. But as I said, you can exit early due to profit cap.
Ernie

Wednesday, May 21, 2008 7:48:00 AM EDT  
Anonymous Anonymous said...

Hi - first I want to say thank you for publishing your OT book - excellent writing.

In this article (as well as in the book), you said "...linear regression of the daily change of the spread versus the spread itself"...by looking the the formula and Matlab example, should this be a more accurate sentance:

"...linear regression of the daily change of the spread vesus the spread's deviation from mean"

?

Wednesday, January 7, 2009 12:08:00 AM EST  
Blogger Ernie Chan said...

Hi Anonymous,
Thanks for your compliments. Actually, whether you subtract the mean of the spread or not will yield the same regression coefficient.
Ernie

Thursday, January 8, 2009 2:50:00 PM EST  
Anonymous Anonymous said...

So when you run the regression, which regression coefficient is the theta?

Monday, January 19, 2009 6:00:00 PM EST  
Blogger Ernie Chan said...

If you regress the change in spread against the spread itself, the resulting regression coefficient is theta.
Ernie

Tuesday, January 20, 2009 8:19:00 AM EST  
Anonymous Anonymous said...

Ah, makes a lot of sense. Of course. I also looked over the code again and saw at the end that you tell the computer that OLS beta = theta. Thanks.

Do you use the adjusted cointegration coefficient as the hedge ratio or the normalized. And if you do a cointegration test on the actual instruments and you get little chance of no conintegration coefficients and an over 55% chance of at most one; can you use that, or is it always better to run the test on first differences where there is always a high probability of two coefficients (using eviews output)?

Tuesday, January 20, 2009 8:52:00 AM EST  
Blogger Ernie Chan said...

Once I find cointegration is confirmed, I actually performed my own regression to find the hedge ratio.

Tuesday, January 20, 2009 7:39:00 PM EST  
Anonymous Anonymous said...

Ok, that makes sense. What do you think about playing with the hedge ratios with the upper and lower bound being the Beta from a regression and Beta from a cointegration regression and seeing which number in between gives you the most stationary series?

By the way, thank you for being a fantastic resource and answering questions. I find that unless you are a math major (which I am not) some of the statistical arbitrage literature is impossible to get through. Once properly explained it seems fairly simple.

Wednesday, January 21, 2009 8:07:00 AM EST  
Blogger Ernie Chan said...

That is not a bad idea. In reality, however, I am not too concerned about the precise value of the hedge ratio. The optimal hedge ratio going forward is likely to differ from the optimal in a backtest period.

Ernie

Wednesday, January 21, 2009 4:14:00 PM EST  
Blogger William said...

Pardon my ignorance but I was under the impression that Brownian Motion (dWt) and Ornstein Uhlenbeck were both modeling processes to simulate expectations...not to analyze past data. If I am wrong please correct me and explain: a) the length of period to use for the mean and s.d. b) how should I calculate dWt using past data (the formulas I see use a random function to generate data points to use...should I simply replace the randomly generated points with the actual historicals?)

I guess my real confusion goes back to my assumption that BM and O-U are forward modeling tools...
Also, once you have calculated an half-life, how should it be applied? Should my calculations produce a new (smaller) half life everyday as the price reverts to the mean? Or will my calculations produce a static (somewhat static) number for the half life and I must then figure out where in the mean reversion process to start counting from?

Wednesday, February 4, 2009 10:34:00 PM EST  
Blogger Ernie Chan said...

William,
If you assume your price process follows a mean-reverting random walk, then you can fit the parameters of the O-U equation based on historical data.

The fitting procedure is a simple regression fit, described in details in my book, as well as explained in the previous comments on this blog post.

Half-life should be fairly constant over time. It should not decrease as the prices mean-revert. You can use any reasonable number of time periods to calculate the half-life. Typically 3 months to a year are suitable.

Hope I answered your question?
Ernie

Thursday, February 5, 2009 11:26:00 AM EST  
Blogger geegaw said...

Perhaps, it isn't necessarily the case that the shortest half life leads to the best trade?

Would a metric like the following:
sdev(spread)/half_life(spread) not be a useful method of ranking spreads? Here, sdev() would need to be expressed as a % of the mean. Alternatively, the percent excursion from a moving average might be used, since that metric is representative of the expected gain?

Saturday, March 7, 2009 5:28:00 PM EST  
Blogger Ernie Chan said...

Hi geegaw,
Thanks for your suggestion. It is an interesting idea. However, the ultimate performance measure for trading a pair is the Sharpe ratio, regardless of holding period.
Ernie

Saturday, March 7, 2009 8:03:00 PM EST  

Post a Comment

Links to this post:

Create a Link

<< Home