S&P 500 component statistics
Author: kelvinyip
Creation Date: 10/21/2013 6:27 PM
profile picture



Where can I get statistics such as number of S&P500 stocks penetrated yesterday's high or low
or number of S&P500 stocks penetrated upper or lower BB band ? Are there such providers ?
profile picture


There are at least 2 ways to get these numbers in Wealth-Lab

1. Index-Lab
- but this requires a pre-defined Index Definition for the specific rule. Check out "Advancing Issues" or "Declining Issues", for example.

2. The old-fashioned way - write a script. For example, run this by clicking only the 1st symbol in a DataSet, like the S&P 500. It could take a minute or two for this to complete depending on the amount of data selected.

Please log in to see this code.
profile picture


Where can I get statistics such as ... number of S&P500 stocks penetrated upper or lower BB band ?

Like Cone said, you need an IndexDefinition for that. Unfortunately, already available CrossOver/CrossUnder index definitions work differently: they count the number of instruments which have crossed an indicator's value whereas you need Price crossing an Indicator.

In next release of MS123 IndexDefinitions (early November), we'll add two more IndexDefinitions that will cover your request:

* Price/Indicator CrossOver
* Price/Indicator CrossUnder

Which will make effortless the creation of index counting the number of S&P500 stocks penetrated upper or lower Bollinger Band.
profile picture


Well, that's ok, I have sort of programmed that in as well. I also got those NYSE stats and advanced decline issue/vol. However, since sp500 changes its components frequently, I wonder if there is any data provider what would give me all the historical numbers.

Sounds like a no to me
profile picture


Obtaining data of delisted symbols and backtesting with dynamic watchlists are discussed here:

survivorship bias / delisted symbols / tickers sp100

But tracking historical component changes is a different story. It's harder to get...

Recent changes to the list of S&P 500 Components
profile picture


actually S&P gives out the current component for free in case anyone wants to know. You can download to xls

profile picture


Eugene and Cone

I have tried the index lab and it works well.. thanks.

I want to find the % of sp500 stocks penetrating yesterday's high/low, would it be there in the next release or I need to do Cone's custom code ?
profile picture


Hint: You could easily find it out yourself by looking at the library's Change Logs:

MS123 IndexDefinitions library

As can be seen there, "Price/Indicator CrossOver (CrossUnder)" are included in the recently released version as promised.

Now, how this can be used to find the % of stocks penetrating yesterday's high/low? Community Indicators includes an auxiliary indicator called ShiftDelay whose purpose is to delay any indicator by a period specified by user. (In Strategy code, it could be any indicator; but in IndexLab's GUI, it applies to price series only.) When creating the new index, choose "Price/Indicator CrossOver" (or CrossUnder), select the price to penetrate the yesterday's value, and then pick "ShiftDelay" from the list. Finally, from its "DataSeries" dropdown you choose High (or Low). Voila.
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).