- ago
Is there a way to query the WLD Indices data to check if a ticker is a valid current constituent? I had a quick look at the WealthDataIndices.txt but that apears encrypted.

I love the inclusion of downgraded or delisted stocks in the WLD Index Data Sets, IMO this is cruitial for more realistic results (avoiding survivorship bias).

I'm thinking of creating a strategy that only enters a position if the ticker is a current constituent of the index, rather than "was a constituent at some time in the past".

The rules would effectively be...

CODE:
If WLDIndex("SP100", Ticker, CurrentBar).isCurrentConstituent = True then ' ticker currently in SP100 list ' enter position end if

There would also be a check to close out positions if removed from index

CODE:
If WLDIndex("SP100", Ticker, CurrentBar).isCurrentConstituent = False then ' Ticker no longer in SP100 list ' close position end if

Ideally these would be build as a strategy condition blocks for easy inclusion in any system.

I believe this would provide a more accurate comparison of strategy performance on a index constituent dataset (Like SP500) against the benchmark (SPY / ^SPX)
0
514
Solved
6 Replies

Reply

Bookmark

Sort
- ago
#1
Because checking the current state of each symbol in a DataSet is an inherent feature of Wealth-Lab's Wealth-Data provider, there is no need to access it via code. Including a symbol when it entered the index and vice versa, closing a position when symbol's got delisted - this is already done by the backtester behind the scenes if using the W-D data provider.

Speaking of the Wealth-Data provider, the means to combat survivorship bias are already built in without any need in handling this via building blocks or code.

0
- ago
#2
ok, so let me see if I understand this....

Assuming WLD Dataset used.

--------
Scenario #1
--------

IF : A position is opened on a current index constituent and the company/ticker is delisted from the index prior to exit conditions being met.

THEN: The BackTester would close the current position on the last listed trading day (at close)? OR wait for Strategy Exit Criteria?

--------
Scenario #2
--------

IF : A constituent is no longer current (delisted fom index - not exchange)

THEN: The Backtester does not process strategy criteria.

Is this a correct understanding?
0
Glitch8
 ( 8.38% )
- ago
#3
Right, and to clarify WL7 will exit a position at the close of the last day a symbol is part of an index.
1
Best Answer
- ago
#4
Good to know, thanks Glitch.

I'll have to put my strategy condition ideas on the back-burner for now.

The issue of surviorship bias is quite complicated when you get into it. Removal from an Index does not mean the company is dead. It could mean that it was purchased privately, merged or just outperformed by a rising star according to index formulas.

Mergers in particular complicate matters further with acquisitions resulting in a transfer in shares to new ticker as well as possible adjustment in qty held.

Take AT&T for example. It was removed from the Dow 30 Index in April 2004, but kept trading until 18 Nov 2005. When it merged with SBC (a then constituent of the DOW30).

Each share of the old AT&T Corp Stock was exchanged for 0.77942 shares of SBC which then changed its name and ticker to AT&T Inc (T) in 2008 while still being listed in the DOW 30 Index.

If a long term strategy based position had been established (with no rule for closing the trade if the Old AT&T was dropped from the index) 1,000 shares in AT&T would have become 7794 shares of SBC which then became 7794 shares of AT&T again in 2008.

The way WLDatasets handle the inclusion of tickers dropped from the index is a big step in the right direction. And is especially important for shorter term strategies.

Personally (ideally), I would like the ability to determine which is better 1) to close a position on the delisting date, or 2) hold the position and exit based on the original strategy (Without opening new positions after delisting). This however would require further tracking and coversion of shares and positions in the case of mergers like AT&T. Like I said, it gets complicated.

So for now, I'll shelve this idea and come back to it later.... Thanks again for your clarification.


1
Cone8
 ( 25.05% )
- ago
#5
QUOTE:
The issue of surviorship bias is quite complicated when you get into it.
You're not just speaking to the choir, I'm the conductor.

QUOTE:
Removal from an Index does not mean the company is dead. It could mean that it was purchased privately, merged or just outperformed by a rising star according to index formulas.
Although the backtester doesn't treat them differently, Wealth-Data symbols have a date and a code for their last-traded date. See the bottom of this page for those details: https://www.wealth-data.com/faq

QUOTE:
Mergers in particular complicate matters further with acquisitions resulting in a transfer in shares to new ticker as well as possible adjustment in qty held.
Wealth-Data accounts for M&A, and where required an appropriate adjustment is made using a "Split Factor". In your AT&T example, T.20051118.A is in the Dow 30 until 2004-04-08, but you can see by the date in the symbol that it continued trading until 2005-11-18, and the "A" means it was either acquired or merged.

QUOTE:
Each share of the is old AT&T Corp Stock was exchanged for 0.77942 shares of SBC which then changed its name and ticker to AT&T Inc (T) in 2008 while still being listed in the DOW 30 Index.
Of course you picked one of the most complicated examples, but we handled it correctly. SBC was also in the Dow 30 since 1999, its symbol is "T" now, which has the SBC history and is differentiated from AT&T, T.20051118.A.

QUOTE:
If a long term strategy based position had been established (with no rule for closing the trade if the Old AT&T was dropped from the index) 1,000 shares in AT&T would have become 7794 shares of SBC which then became 7794 shares of AT&T again in 2008.
Obviously nothing's perfect and limitations apply. There is no "formula" to follow for M&A activity, so we do the best we can to preserve the data and make adjustments to account for things like this. In your 1000 share example, the simulation would sell your 1000 share position. If you want to take action in a strategy then you'll need to program a rule for it.

Note: you can get clues to the changing Participants List<BarHistory> in the PreExecute() method.

QUOTE:
Personally (ideally), I would like the ability to determine which is better 1) to close a position on the delisting date, or 2) hold the position and exit based on the original strategy (Without opening new positions after delisting).
That's could be a valid option for a feature request, but it would wreak a some havoc on the no-programming-required-for-historical-constituents design (see Participants above).

QUOTE:
This however would require further tracking and coversion of shares and positions in the case of mergers like AT&T. Like I said, it gets complicated.
If you need that level of detail, you'll be on your own because we won't be going there. Like I said, there's no formula and you'd be a slave programming something different for every M&A.
2
- ago
#6
Thank you Cone. All understood and greatly appreciated.

I'll look into the Participants List for those clues :)

QUOTE:
Of course you picked one of the most complicated examples, but we handled it correctly.

Yes I did :) AND Yes you did!
1

Reply

Bookmark

Sort