Specifying Stock Universe Day-By-Day
Author: eweaver
Creation Date: 4/20/2018 11:38 PM
profile picture

eweaver

#1
I am interested in determining how to specify which tickers should be utilized for a specific date during back-testing. Basically, I want to use separate fundamental analysis to determine my Wealth-Lab stock universe every day, or every week, or every month, depending on my time horizon. Any suggestions as how to best approach this would be much appreciated. If this question has already been asked and answered, please just point me to the wiki topic.

Many thanks in advance,
Evan
profile picture

Eugene

#2
Evan, welcome aboard.

This isn't a popular request so answer will depend on the details. In general, the idea is to put all your tickers in a big DataSet and then apply filtering rules based on your conditions set in Strategy code to issue signals on certain stocks by some criteria. However, depending on how you do your fundamental analysis a Rotational system may be more applicable. So, if you could be more specific it might get us further with this.
profile picture

eweaver

#3
Hello Eugene, thank you for the welcome and thanks too for your expertise.

My strategy will rely equally on strong stock fundamentals, as well as bullish technical indicators. While it's well proven that using the correct technical indicators can give you a statistical advantage when trading, I feel that the basket of stocks which you trade also gives you a statistical advantage. Some traders want to rotate sectors as sectors come into, and go out of favor (as defined by some metric). My goal is to cherry-pick the actual stocks for my basket, rotating in those with the strongest fundamentals, and rotating out others as their fundamentals weaken.

To programatically generate my ever-changing basket of tickers, I will use an app like VectorVest or Stock Investor Pro, and create a file which contains approximately 10 years worth of stock baskets. These baskets may refresh daily, weekly, or monthly (I need to explore the best time horizon, more on this later). I will include the date for the basket, and the tickers which make up the basket. I'm not sure about where open, high, low, close historical data should live but I was assuming a file per ticker. I can script the data amalgamation to best suit Wealth-Lab.

My expectation is that while my basket may update daily, it will most likely be prudent to create a circular buffer of tickers and add the basket tickers to this buffer and then expire each new ticker after some amount of time. For example, stock tickers ABC and XYZ are in my stock bucket for the week of date April 2. They are placed into the buffer and join a number of other stock tickers which had previously been added. When each ticker is added, I would also attach an expiration date which would limit how long it would remain in the buffer. This buffer would then be my dynamically updated bucket of stocks which my technical indicators would act upon to backtest my strategy.

From reviewing Wealth-Lab, I'm confident that it is powerful and flexible enough to accommodate my needs. That said, getting some sage design directives would be much appreciated so I start down the right implementation path.

Thank you again, and please let me know if you have any other questions.

Best regards,
Evan
profile picture

Eugene

#4
Evan, thanks for your detailed response. So I gather that your basket of tickers will be generated by an external app in a file. Assuming that you plan to backtest those backtests in Wealth-Lab (as they would contain "10 years worth of stock baskets"), I suggest you adopt our established convention for naming the files containing dynamic watchlists and their contents to be recognized by this solution:

Backtesting with Dynamic (Evolving) WatchLists

You can find it in our Community Components extension. As far as backtesting goes, fine. For trading the baskets of stocks generated externally, a different approach is required.

Running your models (Wealth-Lab Strategies) on a daily basis for paper/live trading supposes existence of your dynamically generated stock baskets as Wealth-Lab DataSets. This isn't something you can do on-the-fly - WLP won't read a dynamically generated DataSet until it's restarted. However, DataSets can be created programmatically in WLP like in external tools. Here are some pointers with C# code to pursue this task on your own:

How to create Dataset dynamically?
Is it possible to manipulate DataSet Contents and change symbols programmatically?
How to create/convert GICS database for symbols
profile picture

eweaver

#5
Thanks Eugene, the titles look to be exactly what I need. The wiki appears down now, but I'll read your suggestions when it's back up.

Very best,
Evan
profile picture

Eugene

#6
That's right, the Wiki is down for maintenance today. Sorry for the inconvenience.

UPDATE: The Wiki is up and running
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).