WARNING: S&P 100 Survivorship Bias
Author: kfmfe04
Creation Date: 2/18/2009 7:05 AM
profile picture

kfmfe04

#1
While running "RSI Rotation" on S&P 100, I found it strange that no trades were generated.

When I looked at the bottom left-hand bar, I see a "Need update: BUD, LEH, WB,"...

Need an update, indeed - these stocks have gone bankrupt or have merged/been bought out - which makes me think seriously about survivorship bias? Who knows? In another year, maybe stocks like C and BAC will be kicked out of the S&P 100 and replaced with something else.

This makes me suspicious of the results from any strategy where I am "buy on the cheap" - stocks which die would certainly be kicked out of the S&P 100 making any set I pick, except the set from 10, 15, or 20 years ago (where-ever I start the backtest).


profile picture

Cone

#2
Sometimes stocks go to zero pretty quickly, but normally it's a gradual process. The RSI Rotation strategy takes advantage of this (and volatility), and you'll noticed that it did quite well (at least with the Dow 30) during the dot com bust. BUD, on the other hand, rose quickly when purchased by InBev, and it's unlikely to have caught that one with a "buy oversold" strategy.

Anyway, for sure, survivorship bias counts, and there are methods to use dynamic watchlists. See FAQ #5. The same idea can be applied in Version 5.
profile picture

Eugene

#3
It occurred to me that if the system still holds a position in a stock gone for good (i.e. absense of exit signal), exit can be forced on the last bar - just for simplicity?

CODE:
Please log in to see this code.
profile picture

kfmfe04

#4
Wow - both tips are EXCELLENT.

1. FAQ #5 for dynamic watchlists
2. Liquidating dead stocks

Now, I just have to find a source for historical components of S&P100, DJIA, etc...
Thanks for the tips!

Just a couple quick questions:

1. Will doing FAQ #5 get rid of the "Need update: BUD, LEH, WB," error so the strategy will run to completion? Or will the "more complete solution by kgo thread" be needed to get rid of this error?
2. Is something like a #include allowed for FAQ #5 so I can re-use the code for every strategy run?

BTW, the move to C# is >FANTASTIC< - with built-in Intellisense in the editor, the time needed from idea-to-implementation has dropped dramatically from version 4 to 5 - at least for those of us who are not experts in coding up the original Pascal-like language.

Examples like the RSI Rotation strategy are great for cross-sectional strategies (as opposed to standard technical indicators which are along one specific time-series).

Keep up the great work!
profile picture

Eugene

#5
QUOTE:
2. Is something like a #include allowed for FAQ #5 so I can re-use the code for every strategy run?


Sure, what allowed in C# is allowed in WealthScript: the idea is to store reusable procedures/functions in a compiled library. Take the open-source Community.Components for instance.
profile picture

Cone

#6
Here's another example of a historical backtest with Norgate Data. Since a rotation strategy runs in a DataSetSymbols loop, this one's slightly more complex to get the NorgateIndexConstituentTimeSeries for each symbol. Like the RSI series, it's accessed and stored in a Dictionary for a quick look up.

Notes!
1. You need Norgate Data and the Norgate Data Provider for this script!
2. As coded, you must run this on the S&P 100 Past and Present symbol DataSet - click only 1 symbol to run (AAPL, for example).
3. Code for 5-symbol rotation, therefore choose a 20% position size and perhaps 1.1 : 1 margin for some leeway.

CODE:
Please log in to see this code.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).