Varying Actionable Universe Over Test Duration

Discussions about the testing and simulation of mechanical trading systems using historical data and other methods. Trading Blox Customers should post Trading Blox specific questions in the Customer Support forum.
Post Reply
CJ
Contributing Member
Contributing Member
Posts: 7
Joined: Fri Dec 11, 2009 6:29 pm

Varying Actionable Universe Over Test Duration

Post by CJ »

I am brand new to Trading Blox, but assuming I have been saving CANSLIM ratings on stocks for years and want to use them as a pre filter to narrow my actionable universe, can someone point me to a thread or post that will instruct me how to account for a list of stocks that changes over the duration of my expected test length?
For instance say over the last 20 years I want to backtest a system using a list of 400 stocks, but during any given week of the test period the subset of stocks I am backtesting will be a function of the CANSLIM ratings. Obviously if the test establishes a postion in a particular stock prior to being removed from the testing subset, its data will need to be included until the system closes me out.
sluggo
Roundtable Knight
Roundtable Knight
Posts: 2987
Joined: Fri Jun 11, 2004 2:50 pm

Post by sluggo »

Can't point you toward any specific articles, sorry.

However I suggest that one good heuristic to help you figure out how to program a trading idea, is to ask yourself "how would I do this in real life trading?". Once you've figured out how you would do it in the real world, just program that in the simulated world and Bob's your uncle.

For example, you might do this CANSLIM business in real life, by keeping a Folder full of Papers. Each Paper is a list of stocks that is valid for one week. Then you would also have a Master List which is just a two column table:
  • Column 1: Date
    Column 2: Name of the Paper containing the list of valid stocks for the week beginning on (the date in Column 1)
Voila. You're done.

To trade this in real life,
1. Look up today's date in the Master List. Find the Paper for today.
2. Grab the Paper and read the list of today's actionable stocks.

To program this into your simulator, you would first
1. Write each weekly stock list (a "Paper") into a different .TXT (or .CSV) file
2. Write the Master List into a .TXT or .CSV file

After those files are prepared, your program would
3. Have your simulator read the Master List
4. Have your simulator use today's date to access the Master List and get the filename of the appropriate weekly stock list.
5. Read the weekly stock list file.
6. Now you know which stocks you can, and cannot, trade this week.

Your "portfolio" would be the inclusive-OR of all stocks that appear on all Pages for all weeks.

But that's just one way to skin the cat.
CJ
Contributing Member
Contributing Member
Posts: 7
Joined: Fri Dec 11, 2009 6:29 pm

Thank you

Post by CJ »

I am greatful for your reply, and unfortunately its what i had anticipated. Once i do have the date ranges for what is actionable during a given week, can i code the field in the data file that indicates the stock did not trade for each day during the testing period that a stock is not actionable. Could i then use trading blox full functionality on the entire list for a given period or could i expect the stocks coded as 'did not trade today' to generate an error?
Post Reply