Survivorship bias

I was looking to do some testing on individual stocks for the NDX and SPX and was going to use IsIndexConstituent to check if a stock was in the index on the date when the model is run many years ago. I am getting an error. Does that no longer work or is there another way to avoid survivorship bias when selecting stocks that are currently in the index but might not have been several years ago as well as ones that have died. I am using Norgate with historical data for the idices.

IsIndexConstituent() is NOT AmiBroker function, but Premium Data plugin function. You need to ask Premium Data for the details how it works.

Thanks for the clarification.

From the Norgate website:

AmiBroker: NorgateIndexConstituentTimeSeries is now the only AFL function available. The deprecated function name IsIndexConstituent has been retired.

Here is more from Norgate:

Making use of Historical Index Constituents

To determine whether a stock was in a particular index on a given date, use the function NorgateIndexConstituentTimeSeries by adding it to your “Buy” condition:

AND NorgateIndexConstituentTimeSeries(“index symbol or index name”)
where the index symbol is $DJI (Dow Jones Industrial Average), $RUA (Russell 3000) and so on.
The index symbol or index name must be wrapped in “quotes”. For example:
AND NorgateIndexConstituentTimeSeries(“S&P 500”)
If you wish to stipulate membership of one index but not of another, use (for example) -
AND NorgateIndexConstituentTimeSeries("$XAO") AND NOT NorgateIndexConstituentTimeSeries("$XTO")
When using the NorgateIndexConstituentTimeSeries function to run a back-test against a particular index, we recommend referencing the Watch List that contains the current and past constituents for that index (specify this Watch List in the Analysis Filter window). This will provide a faster result than running the test against all symbols.
Note: You will need either a Platinum or Diamond level package subscription to access Historical Index Constituents, as only these packages include delisted stocks.

1 Like

Awesome....thank you...appreciated.:smiley:

Hi all,

I am attempting to use that same function which I double checked via the Norgate site is still the correct syntax (see screenshot attached). Unfortunately I am receiving an error (see screenshot attached). Can anyone point me in the right direction as to what I am missing?

Norgate website
Index Constituents Error

@nicolasvaughan you have not included a code that a potential helper could use to replicate your error. Just a screen capture of two lines. So I can just take a wild guess and ask did you include Norgate's full functionality with this at the top of your code?

#include_once "Formulas\Norgate Data\Norgate Data"

@portfoliobuilder yessir! That did the trick, thank you for your help :pray: :pray: :pray:

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.