Friday, September 30, 2011

Stop loss, profit cap, survivorship bias, and black swans

I have long espoused the view that we should not impose stop-losses on mean-reverting strategies, nor profit caps on momentum strategies. My view on the latter has not changed, but it has evolved on the former.

My original reason for opposing stop-losses on mean-reverting strategy is this. Say you believe your specific price series is mean-reverting, and say you have entered into a long position when the price is low. Now, however, the price gets much lower, and you are suffering a large unrealized loss. Well, based on your mean-reverting belief, you should buy more instead of liquidating! Indeed, if you backtest the effect of stop-losses on mean-reverting strategies, you will almost inevitably find that they decrease the overall returns and even Sharpe ratios.

But what this simplistic view ignored is 1) survivorship bias, and 2) black swan events. (Hat tip: Ben, who prompted me to consider these two issues.)

1) We normally would only trade those price series with a mean-reverting strategy only if we see that the prices did eventually revert. No one would bother to trade those price series that used to mean-revert, but suddenly stopped doing so. But saying that stop-losses are harmful to mean-reverting strategies is ignoring the fact that some mean-reverting will stop working altogether and would not survive our strategies selection process.

2) Let's define black swan events as those that did not occur in your backtest period. For example, let's say you never had a loss of 20% in a single day. So if you backtest a stop-loss of 20%, it will have no effect whatsoever on your backtest performance. However, no one can say for sure that it won't occur in the future. So if you or your investors simply cannot tolerate a 20% loss, you should impose this as a stop-loss. (After all, your brokerage has already imposed a stop-loss of 100% on you whether you like it or not.)

We can in fact turn point 2) around when deciding what stop-loss to use: a stop-loss should be loose enough so that it should have no effect on the backtest performance, and of course tight enough so that it will not result in the demise of your trading career.

There is also the issue of whether to use stop-loss on the intraday drawdown, or to use it on the multiple-day drawdown. I would argue that only intraday stop-loss is important to prevent a black-swan loss. In practice, when a strategy has a string of non-catastrophic losses occurring over multiple days, resulting in a large, unprecedented, drawdown, the trader will typically re-examine the strategy, taking into account this most recent performance and tweak the strategy so that it could theoretically be avoided. This is almost like a multi-day stop-loss strategy, as we stop an old strategy and start a new, modified, one. (Though the modified strategy might still recommend that you keep holding the current position!)

Now why am I still holding dear to the principle that one should not impose profit-caps on momentum strategies? Why, the possibility of black swan events again! But this time, any black swan can only result in unprecedented one-day gain instead of loss, since we should always have stop-losses on momentum strategies. We certainly don't want to impose a profit-cap to rule out this possibility!

60 comments:

Yaba Qi said...

Hmm... That's why some stocks were sold in the midst of the Flash Crash at incredible low prices: to comply with stop-loss policy in case of Black Swan event. I see.

Or maybe, some Black Swan events are just the result of stupid policies. Like stop-loss?

Anonymous said...

You better use time stops. Whatever your investment has a fixed "optimal" time horizon or it is liquidated in any case after a certain time horizon whatever convergence happened or not.

Stop losses are in general NOT a good idea.

Bernd said...

Hi Ernie!!

Isn't the use of the half life a measure good enough as a stop loss? Not in quantity but in time?

Ernie Chan said...

Hi Yaba, anon, Bernd,
If the strategy calls for exits at a specific time, or exit when the half life is exceeded, of course we should exit at those times. The stop loss I refer to is one that should not have been used at all in the backtest period, but is designed as a stop against black swan events.

It is true, however, that stop loss does not work well in equities trading, because of the lack of liquidity (e.g. during the flash crash) needed for the exit, and the possibility of gaps due to trading halts in specific stocks or across the entire exchange. The idea really works only in futures and FX, and you do see it implemented much more widely in those markets than in equities.

Ernie

Puzzled said...

Hi Ernie,

the idea of not having a profit cap for momentum strategies sounds interesting, but I am not sure then, e.g., for the London Breakout, what would you use instead of that?

Talking about the London Breakout, I have been trying to back-test it and noticed that its returns have been significantly decreasing over the years. I am also getting a rather small Sharpe ratio for the back-tests (hardly greater than 1 for 2011 so far). I was wondering if this is typical for FX / momentum strategies, and whether one would still leverage with such numbers?

Ernie Chan said...

Hi Puzzled,
If you don't use profit caps for a momentum strategy, you can still exit the position at a specific time after entry, or when the market closes for the day.

I don't find it generally true that FX/momentum strategies lose returns over the years. In fact, I find quite the opposite. But if you specific strategy has a Sharpe ratio less than 1, I would recommend you check out Kelly formula to see what is the maximum leverage you are allowed, and make sure you are trading less than half of that leverage.

Ernie

Antonino Porcino said...

Hi Ernie, suppose you have a trading strategy that you can repeat over time with expected return m>0 and stddev s. If you impose a stop loss below zero you are actually trimming the negative tail of the distribution, thus increasing the mean m and reducing s. I have empirically tested this to be true with random walk returns. So this would suggest that stop losses are useful regarderless of the type of strategy used. I know my reasoning is wrong but can't tell where :-)

Ernie Chan said...

Hi Antonino,
One cannot estimate the effects of stoploss by simply removing those data points that have negative returns. By imposing stoploss, you may also move some of the points with positive returns to have zero returns instead. The only way to estimate the effects of stoploss is to perform a complete backtest.
Ernie

Anonymous said...

Hi guys. Hope you could visit my blog: http://openbooktrader.wordpress.com

Cheers!

quantitative trading said...

Hi,
The actual calculations utilized by computer systems involved in short term trading are made to determine the tiniest associated with specialized indications as well as arbitrage possibilities as soon as possible.

Anonymous said...

Mean reverting strategy depend on the underlying fractal dimension. For example if the fractal dimension dimension is higher than 1.5 that means that the price action is more probable to revert than to continue in the same direction. If you have this on some time frames this makes a very particular situation. That situation exist on the pair EUR/CHF. For an expert it is possible to use this relationship combined together with a fundamental data and make a profit factor beyond 30. You can chech this on this group

http://beathespread.com/groups/profile/467/ea-expert-advisors-and-speculative-opportunities

Curiouspeter said...

For longer time horizons I wonder if some mean-reversion strategies can be implemented with vertical option spreads. They may be attractive because:

1) There is no tail risks
2) Profit is mostly capped anyway
3) We have an idea how long the trade may last

What do you guys think?

Ernie Chan said...

Curiouspeter,
I discussed options strategies in this post: http://epchan.blogspot.com/2010/09/implementing-stock-strategies-using.html

The main problem with using stocks options is the wide bid-ask spread and the low liquidity. Transaction costs tend to eat up most of the potential profits. I find that even FX options have too little liquidity for high frequency trading. However, the situation may be better for stock index options. I will wait to hear from the experts on this topic here...
Ernie

Curiouspeter said...

Ernie,

You are right, options are not suitable for high-frequency mean-reversion type trading. One will probably have to carry the position overnight for it to be worth the bid-ask spread.

ETF options like those of SPY appear to have pretty good spread and liquidity (relatively).

Index options (SPX, OEX) have large spreads nowadays and you have to haggle with the market makers.

BTW, do you guys know if broad-based index ETF options are considered 1256 contracts or not?

Regarding Black Swan, it is really a problem pertaining to epistemology rather than strategy or modelling or testing.

Unfortunately mean reversion strategies (compared to momentum ones) are particularly vulnerable to these not-so-mythical birds.

Anonymous said...

Hi Ernie,

The topic of mean-reversion reminded me of an issue with cointegrating pairs I ran into some time ago. I apologize in advance that this is somewhat on a tangent.

Is it possible for the regression coefficient to be negative on a pair, resulting in a long position in both securities (or short position in both securities)? Or would this be evidence that there is no cointegrating relationship? I believe I was using the Engel-Granger test that rejected the null of no cointegrating relationship with a significance level of 0.05.

Thanks,
Mike

Ernie Chan said...

Hi Mike,
It is possible to obtain a negative hedge ratio. For e.g., you will probably find SPY cointegrates with SH, the short SP500 ETF but the hedge ratio is about -1.
Ernie

李岩 said...

Hi, my name is Liam,

I've bought your book 'Quantitative Trading'.

I'm currently looking intraday Forex data for back testing. According to Table 3.1 of your book, GainCapital.com has free data with long history. But I search their website but couldn't find any.

I don't know where to find you but would like to post here for your comment. Any help would be appreciated. Thx!

Ernie Chan said...

Hi Liam,
It appears that GainCapital is no longer providing free intraday FX data. You can still get that via Interactive Broker's API if you are a customer. Otherwise, you can purchase that from forextickdata.com.
Ernie

marc said...

Why not employ a mean reverting stop loss? I use keltner bands as a measure of volatility to enter as well as to exit. The exit does not take into account where price is in relation to your entry. Once it has reverted to the mean by touching the opposite side of the bands from which it came, it is time to exit.

I have been doing this for many years int he forex market and it creates minor draw downs in comparison to the results.

Ernie Chan said...

Marc,
When the price reverts to the opposite bank, I believe that it is likely a profit exit. What if the price never reverts? How do you exit then?
Ernie

Anonymous said...

The gain capital forex rates are aviable at: http://ratedata.gaincapital.com/

李岩 said...

Thank a lot Anonymous and Ernie:)

olafhel said...

you can find around ten years of hourly/data for free at this site http://www.fxhistoricaldata.com/.
Quotes coming from yahoo so if you are using Interactive Brokers you will find some deltas.

Concerning taking profit on momentum strat.: I found on my particular strategy that it improves my Sharpe Ratio and lower my drawdown. IMHO I think it's due to the fact that it takes advantage of the regime switch ( momentum -> mean reversion) at the higher frequency level. So the strategy acts with a mixed behaviour (MM+MR). You follow the momentum when the move start and once it fades you hedge your position with an opposite mean reverting trade which is actually your take profit.

Concerning the SL: I always use stop.

Anonymous said...

Anyone can tell me the data format of GainCapital.com's historic data? Thanks

olafhel said...

Anon,

Check this post http://numericalmethod.com/blog/2011/05/01/gain-capital-fx-rate-data/

Anonymous said...

Soom, I got that website and the java codes. Thanks anyhow.

The first column in the data files *.csv is referred to as "Tid" in the java code. What is it? Time ID, or tick ID, or anything else.

Thanks

olafhel said...

Anon, I took a look at the files and frankly I have no clue sorry.
What could be helpfull is either to ask Haksun Li or GainCapital directly. I'm sure they will answer.
And be kind enough to share with us once u have infos ;).

Doug said...

How did your strategies perform during the Flash Crash? Did you have enough of a capital cushion to ride out the drawdown? Did you have any risk management systems in place that avoided buying into the crash?

I heard that many leveraged stat arb firms took huge losses that day.

Anonymous said...

Soom, I could only take a guess; and as people say: your guess is as good as mine. I don't believe that anyone in GainCapital would even bother to drop me a line, and that's the price for "free" data. So that is that for now. Sorry. Until there comes Mr. "KnowItAll", so long.

Ernie Chan said...

Doug,
We did exceptionally well during the flash crash, but we didn't do well during the August 2011 crisis. They are different strategies though.
Ernie

Anonymous said...

I find that stop losses are useful in mean reversion strategies mostly because they allow me to know what the maximum loss would be, so that I can safely use more leverage. The unleveraged return almost always decreases with stop-loss orders, but the leveraged return often goes up. The optimal Kelly leverage on my current strategy is close to 40, but I don't want to have the stops closer than 5%, so I'm not willing to use more than about 8x leverage (and that still requires a high risk tolerance).

Profit targets on momentum strategies can be useful because they allow you to catch intraday price moves that you would otherwise miss. But if that is your goal, you should move them up above where you expect the intraday high to be every day (or below the expected intraday low for shorts). And you should consider reopening the position when price falls back in line.

jkw

Ernie Chan said...

jkw,
I agree with your point about stoploss.

Regarding profit caps for momentum strategy, I find them to be arbitrary since there is no natural profit target, unless you believe there is mean reversion on a shorter time scale superimposed on a longer term momentum model, in which case you can define a natural profit target. This is similar to what Soom said above.

I regard mean reverting model to be similar to selling calls (a point made to me by Haksun Li privately). Obviously there is the potential for unlimited loss. So one has to have a stop loss, which is like buy a call at a price farther out. No options seller would disagree with buying this call for protection.

On the other hand, a momentum strategy is rather like buying calls. Many options buyer would rather that the call expires worthless than to limit its profit potential by selling a call at a higher price if the option premium is cheap enough. Well, in our case the option premium is the average loss of the momentum strategy. If your momentum strategy has frequent losses, than it may be advisable to set a profit target too.

Ernie

Anonymous said...

Ernie,

It's my impression that your favored trading strategies have changed over the years since you've been writing this blog. Am I correct? I'm referring to the strategies that you actually use in real life. I think it would be interesting if you could write a post that explains what strategies you've tried over the years, what lessons you've learned, when/why you decided to change your focus, which things have been successful, and which ones have not. Sort of like an overall narrative/story of your trading experiences. I realize it may be difficult to write about things that have not been successful, but those experiences are sometimes the most interesting and useful to read about.

I would also like to say that I like your blog a lot. Your writing style and the topics you write about are quite interesting.

- aagold

Brijen Hathi said...

I thought mean reversion should work fairly well in times of high volatility.
The Currecny Forecasting Blog.

Brijen Hathi said...

Mean reversion should work in times of high volatility as values sweep to and fro its 'highly dynamic neutral range'.

The Currency Forecasting Blog

Ernie Chan said...

Aagold,

My favorite strategies have evolved, but continuously. Thanks for your suggestion about an article detailing this evolution, I am indeed write one in the near future. But here are the highlights:

1) I now favor higher frequency strategies.
2) I now favor FX over stocks.
3) I appreciate momentum strategies better, though most of my strategies are still mean-reverting.
4) I appreciate better the limitations of Kelly formula based on the gaussian assumption.

More on these later!
Ernie

Ernie Chan said...

Brijen,
In theory, yes, mean reverting strategies benefit from high volatility, assuming that you have infinite capital. But for many practical strategies, once the volatility exceeds a certain range, buying power is exhausted, and losses set in. One can tune the strategy to adapt to either high or low volatility, but hard to benefit from both.

Eernie

Anonymous said...

Ernie,

The highlights you mentioned sound interesting - look forward to the full article.

I'm curious about #2 (FX instead of stocks). I assume that's because more leverage is available. Did your experimentation with stock options not work out well? I recall that in a previous post you wrote about your discovery that options had some better characteristics than stocks. I'm also quite curious about #1 (higher frequency strategies).

Thanks,
aagold

Ernie Chan said...

aagold,
I like FX better because of higher leverage and higher liquidity. You may find from my comments on my optiosn post that stock options are too illiquid for stat arb strategies. If you hold them for many days, then they may work. But I like higher frequency strategies because they generate better returns with lower risk.
Ernie

Anonymous said...

Ernie,

Seems like FX has a big problem though: it doesn't trade on an exchange. So you're at the mercy of your FX broker. What about trading currency futures contracts? Those do trade on an exchange, but there's probably much less leverage available.

- aagold

Ernie Chan said...

Aagold,
You are right, FX does have counter-party risk, beyond the risk of a MF Global event. Trading futures eliminated counter-party risk, but it has lower liquidity.
Ernie

Anonymous said...

Actually I wasn't referring to counter-party risk, I was thinking more about bid/ask spread. When you trade FX, you get the bid/ask spread offered by your broker. You don't get to see the highest bid or lowest offer existing anywhere in the market. When you trade over an exchange (such as a futures exchange), however, the system is transparent so you get to see the actual bids and offers.

- aagold

Ernie Chan said...

Aagold,
That depends on your FX broker. For e.g. Interactive Brokers offers direct access to 13 banks' quotes, with "no markups or hidden price spreading". All they charge are commissions.
Ernie

Anonymous said...

Hello Ernie,

In the future would you consider making 1-2 posts on factor models that are not pca-based but rather the factors are chosen by the trader?

Ernie Chan said...

Hi Anon,
My experience with fundamental factor models had not been good. I also think this type of models are unsuitable for independent traders or small hedge funds. Beyond this, I am afraid I don't have much more to say about them!
Ernie

Anonymous said...

Hello Ernie,

I remember an older post of yours discussing factor models and your scepticism on them.

I don't myself if factor models can produce alpha or not, this technique may be overcrowded.

Still could you please explain why in particular for individual traders/small funds factor models are not a good approach in your opinion? do you find the labor required to create them too intense for smaller teams and essentially pnly hedge funds who employ hundereds of people can use factor models?

Anonymous said...

Also if you had the time to provide some references on factor models, pls do so. FYI I'm a desk quant so I'm looking for something technical & addressed towards people in the industry but not too academic, rather something from a practitioner.

Anonymous said...

Hey, ANON, could you tell us what is "desk quant"? as vs. what?

As Ernie already said "I am afraid I don't have much more to say about them!", it seems that you really think that you have something to show. So please tell us what makes you so interested in "factor models" or "PCA"? Please!

Ernie Chan said...

Hi Anon,
If you search for the term "factor" in the search box at the top right corner of my blog, you should find all my articles on factor model.

It is particularly inappropriate for smaller accounts because it requires too much capital as it holds too many positions, and it holds them for too long. (Fundamental factors don't typically change too quickly.)

Even for large accounts, I find their performance to be uninspiring compared with pretty straightforward price-driven models, unless of course, you have special insights into constructing the right proprietary fundamental factors, and not just using the canned factors that a vendor provides!

Ernie

prem nath said...

The only way money can be extracted out of markets is by taking speculation out of speculation(means trader has to be neutral in market direction).Good way to do it would be--Assume S&P 500 is at 1300 & daily trading range is 13 points.That is 6 1/2 points up/down over say 1000 runs.
Volatility expands transiently in every time span & that is when mean reversion is the best.6 1/2 into 3=19 1/2.My method would be sell short at 1320 take profit at 1311 & stop loss at 1329(as buy order next delivery month).Reversal order again is subject to same rules.Trading is always counter trend and continuous in both up/down markets.There is no input from the OBSERVER.Every thing is based on opening price every day & volatility has to expand at least 250%.Empirical evidence shows that this happens al least 5 times more often than SD numbers lead us to believe.That is why option writers go belly up lot sooner than they are led to believe.Trader has to make money from random motions of prices of the underlying asset.There is no other salvation.Even the creation of UNIVERSE is just combination of zeroes/ones all at random.ONLY after the creation universe operates subject to the PHYSICAL LAWS.ALL the miseries for trader come from guessing the next market move.I would be glad to communicate with any one to show that THIS works & also invite your input.email indus68@gmail.com.I am a private trader & I sell nothing-just a trader day in & day out.The method can be applied to any asset in any MARKETS(stocks,bonds etf futures commodities currencies indices).ALL comments from serious practioners would be answered even through email

Adrian said...

Hi Ernie,

I'm really enjoying your blog, which is kinda wierd for a math dropout to be enjoying this stuff - perhaps its just the delivery?

I pair trade and was interested in your discussion in your book about stop losses based on half-lifes of a pair. I have found some C and matlab examples of Ornstein-Uhlenbeck, but ideally would like something in excel, have you seen such a beast?

Adrian

Ernie Chan said...

Hi Adrian,
All you need for half-life determination is linear regression fit. You can use Excel's linear regression function for that.
Ernie

Adrian said...

Thanks Ernie,

I think I need to take a few steps back from your statement. From your book I can take a regression of the change in the spread from the spread itself, but from their I'm unsure of which values to use for theta.

I'll spend some more time researching the topic.

Adrian

Ernie Chan said...

Adrian,
There is a line theta=results.beta in in my book, which is a bit hard to read because it is missing a newline character.
Ernie

Adrian said...

Thanks Ernie, I'll check it out, Just out of interest can you post the current half life of GLD/GDX so I can know I get the same results?

Anonymous said...

Hi Ernie,

Do you have any links to trailing stop loss code for matlab?

Curious.

Ernie Chan said...

Hi Curious,
I unfortunately don't have any links to trailing stop codes. But if you use Interactive Brokers, they already implemented this order type for you, and you can submit it using their API (or through Matlab-IB's API).
Ernie

Nifty Trader said...

Hi Ernie Chang, I would say if you are using leverage in any form SL is essential. If no leverage no SL required. If you are advising no SL on mean reverting strategies, which are proven wrong unless the assumption is violated and if leverage is also used, you just have to wait for the mean reverting product to turn to a momentum product to wipe your account. And, if you don't have guts to put a SL when using leverage, better not trade.

Brijen Hathi said...

I would agree with Nifty Trader, in that a Stop Loss (SL) is essential in any leveraged product. The problem in practice - certainly in the leveraged FX arena - is that your own broker places a series of trades that tend to cut your positions out, even if the price later reverts to a safe zone compared to your SL.

Brijen Hathi,
The Currency Forecasting Blog.

tradingboy said...

I think this have nice information. I usually use stop loss in trading of any kind to protect my money. Good to read on this.