No. of Recommendations: 98
I recently got my hands on a database of quotes and decided to turn loose some simple RS based genetic algorithms on it. I'm posting this because I thought some of you might be interested in what I've seen so far and to solicit advice.

The database has quotes for about 3000 stocks for all of last decade. But the nature of the database is that it only has quotes for what were the 3000 stocks of largest market cap as of about 2 months ago. So it doesn't have data for acquired/defunct companies and therefore has the "survivorship bias" problem that has been mentioned on this board before for backtesting. And there's no ValueLine timeliness information in it. So the screens I'm doing are based on strictly RS from a large selection of stocks.

With the RS screens followed here, I've wondered about some of the parameters that seem to be arbitrary to me. So I coded a set of GAs to pick random values for

1) The period of time for which RS was determined
2) The number of stocks selected
3) The holding period before rebalancing

What I did was create a population of 1000 "investors" and for each one assign at random an RS period between 2 days and 2 years, a stock selection count of between 1 and 20, and a hold time of 2 days to 2 years. For the RS periods, I'm simply choosing the stocks that have appreciated the most for the n days assigned at random to the "investor" at rebalance time. So each investor, on it's rebalance date, will look for the stocks with the highest appreciation for the last n days, select between 1 and 20 of the highest, and hold it for between 2 days to 2 years. So after random assignments were made for these 3 parameters, I let all 1000 "investors" munch through the data for 1992-1999.

At the end of this, I let the population of "investors" evolve by doing 2 things. First, I "killed" the 20% of the "investors" with the weakest returns and replaced them with new random values for the 3 parameters. The next lowest 20% I replaced with children of the top 40% who would inherit at random one of the 3 parameters from a pair out of the top 40%. Then I repeat the whole process over and over and over.

I also made the starting rebalance date a random date in the first 3 months of 1992. This takes care of "investors" that appear to be good just by luck of the starting date. For example I did one run where and RS period 2 day hold one stock for 190 days did
incredibly well, but on the next go around with a different starting date dropped out of the running.

So what I've seen so far, after about 10 or so evolutions, this "gene" starts to dominate: "130 +/- 5 RS period : 4 +/- 2 stocks to hold : 140 +/- 5 hold time". For parameters 1 and 3 I'm using just market
days. So guess who this is? 130 market days = 26 weeks. It's RS26! With a holding period of 28 weeks? And CAGRs that are well documented here (mouth watering). So I guess I really don't have anything new to report, just more confirmation.

I'll caveat this by saying that I've done all this in the last couple of weekends so I consider results to be very preliminary and I don't entirely trust my software yet. But it sure was fun, and when it
magically turns up an old friend I think things are looking good. The advice I was looking for was critique from any GA wonks out there, and anybody who knew where I could get good/better data for this at
a reasonable price.
Print the post  


What was Your Dumbest Investment?
Share it with us -- and learn from others' stories of flubs.
When Life Gives You Lemons
We all have had hardships and made poor decisions. The important thing is how we respond and grow. Read the story of a Fool who started from nothing, and looks to gain everything.
Contact Us
Contact Customer Service and other Fool departments here.
Work for Fools?
Winner of the Washingtonian great places to work, and Glassdoor #1 Company to Work For 2015! Have access to all of TMF's online and email products for FREE, and be paid for your contributions to TMF! Click the link and start your Fool career.