Find Stock Splits
Author: mgrech004
Creation Date: 6/13/2011 10:49 AM
profile picture

mgrech004

#1
Hello there.

I am looking for a script that scans a list of stocks going back 5 years and issues a message if any of the stocks in the list had a split at some point in the past 5 years. Any help would be appreciated.

Thanks,

Mike
profile picture

Eugene

#2
Try this example. Run in multi-symbol backtest mode to get the output for a DataSet:
CODE:
Please log in to see this code.
profile picture

mgrech004

#3
Thanks Eugene. If I want to go back 10 years, do I change the 5d to 10d?
profile picture

Eugene

#4
Sure. Make sure the data loading control is configured to load All Data.

As a DIY excercise, you can make the choice interactive through Straps (Strategy Parameters). See the Programming Guide > Programming Trading Strategies > Strategy Parameters.
profile picture

mgrech004

#5
Hi Eugene,

I did this and it works well. I realized however that this script only shows me the last stock split. How do i modify it so that is shows me all the splits for a particular stock?

Thanks.
profile picture

Eugene

#6
See FundamentalDataItems in the QuickRef for an example of looping thru a FundamentalItem collection.
profile picture

mgrech004

#7
Thanks, this does it.
profile picture

Musashi1970

#8
Hello
I used to apply Eugene's code above once in a while, but it does not seem to work anymore. Is there a possibility to fix that ?
profile picture

Eugene

#9
Hello Patrick,
The code still works, of course. You just need to fine-tune it because the naming of items is individual across fundamental providers. Notice this:

CODE:
Please log in to see this code.


Uncomment the one you're planning to use, and comment the Fidelity item.
profile picture

Musashi1970

#10
Hello Eugene

Thx for the quick response.

When I try either Yahoo or MSN, I got no results at all (the debug window shows nothing) for e.g. S&P 500/400/600 stocks.
profile picture

Eugene

#11
The MSN provider's version must the latest (2013.06) to work properly. Previous versions will not work at all:
QUOTE:
Fix: due to past MSN website redesign, dividends/splits stopped downloading

With both providers, make sure that the data loading depth is adequate (try it with "All Data").
profile picture

Musashi1970

#12
I had all settings as you suggested already. It does not seem to work...

Just to make sure, I do not have to use Datsets with Yahoo or MSN as a price source as a pre-condition, right ? (Because I use BB- and iqFeed as a source for my datasets, but the tickers are naturally identical)
profile picture

Eugene

#13
QUOTE:
Because I use BB- and iqFeed as a source for my datasets


And it was a key omission that you're using a different data provider:

QUOTE:
Just to make sure, I do not have to use Datsets with Yahoo or MSN as a price source as a pre-condition, right ?


Only partially right. Until you update the MSN/Yahoo DataSets, the MSN/Yahoo fundamental data will not be available. Only when you update a MSN/Y DataSet, the built-in fundamental providers have a chance to download the split/dividend items for included symbols. Afterwards, any data feed can be used provided that the tickers are naturally identical.
profile picture

Musashi1970

#14
QUOTE:
and it was a key omission that you're using a different data provider:


yep, sorry about that. I had the opinion that it had worked with this setup in the past, but maybe I remembered wrong.

QUOTE:
Only partially right. Until you update the MSN/Yahoo DataSets, the MSN/Yahoo fundamental data will not be available. Only when you update a MSN/Y DataSet, the built-in fundamental providers have a chance to download the split/dividend items for included symbols. Afterwards, any data feed can be used provided that the tickers are naturally identical.


Great, now it works again.

Many thanks
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).