mattie_shoes
Stock Prediction Results
So I worked on my stock analysis program over the weekend, and I kind of took two steps back in order to take one step forward. But now I've got a much more flexible base for testing ideas.
As a test of my program, I created an indicator. The indicator returns a value from 0 to 99, indicating where the stock is in terms of the window created by the 52 week high and the 52 week low. If the stock is setting new highs, it would read 99. If the stock was hitting new lows, it would read 0. Halfway in between the two would read 50.
Now I wrote an analysis class that goes through all the historical data for a list of stocks (in my case, I just used the S&P 500 list), finds the indicator reading, then notes where the stock is in 1 month, 3 months, 6 months, and a year. Now without any guesswork from me, it knows how a stock setting a new low would perform compared to a stock setting a new high. And it can also compare those to any other value the indicator would give.
The answer to the setting new lows vs setting new highs comparison is not intuitive. I would assume that a stock setting new highs is doing great, they're making money, everything they touch turns to gold... Stocks that are setting new lows are coming apart at the seams. But the stock setting new lows will perform much better on average in any of the four time frames I chose.
I suppose it does make an inverted sort of sense -- The market takes into account not only what you're doing now, but what you're expected to do in the next year or years. Having everything you touch turn to gold is a tough thing to keep doing. The first sign of a falter and the stock drops. But a company that's doing lousy in every way? Well, all they have to do is look like MAYBE they'll turn things around and their stock will soar!
Another interpretation is another market truism. The market hates uncertainty. You pay a premium for a stock perceived as 'safe'. People REALLY don't want to lose their ass when they're invested, so a company with low downside is priced to reflect it. So for a stock that's in trouble, the inverse is probably true. Those safety-loving investors are jumping ship and they're willing to sell at a discount.
Now there are some problems with my example... I used S&P 500 stocks. S&P 500 stocks are all wildly successful compared to the market at large, and we already know that they're CURRENTLY wildly successful. So if IBM set a new low in 1967, we know it recovered because it's kicking ass today. My little model doesn't take into account all those stocks that set new lows and went on to go out of business, or get bought out, etc. because they aren't in the S&P 500 today. Basically, IBM setting a new low today doesn't mean the same thing as IBM setting a new low in 1967.
So I wrote a forward tester . What it did is to use all the data for stocks up to 2005 as a base to make predictions, then made predictions for all the stocks from 2005 to May 4, 2006. The graph above is the results. The X axis is the prediction made, and the Y axis is the average actual result for that prediction. The diaganol line is where the predictions exactly match the average return.
The red dots on the bottom left are my 1 month predictions. As you can see, while they don't perfectly follow the line, they do seem to follow the model pretty well. The yellow dots are my 3 month predictions. They also seem to predict reasonably accurately. The green dots are my 6 months predictions, and they also seem to do quite well. I was really quite surprised with the results thus far. I really expected the stocks at new lows to not behave as the model suggested.
But then all hell breaks loose. The blue dots are my predictions for 1 year. As you can see, they're all over the place, and they actually seem to be the inverse of what my analyzer predicted!
I suppose there's a million ways to analyze this, but this is what I'm guessing it means:
The stock market overreacts to recent news. This is one of those truisms of contrarian investors, and it seems there may be some truth to it. If a stock is setting new highs, the recent news on that stock is almost certainly good. If a stock is setting new lows, then the recent news is almost certainly bad. In the middle, it's a crapshoot. So if the recent news is bad and the stock is setting new lows, it's probably undervalued. The stock will correct upwards over the next several months.. If the recent news is good, pushing stocks to new highs, then as the stock may be overvalued -- as soon as the good news stops, the stock will correct downward.
That explains my 1 month, 3 month, and 6 month predictions, but what's causing the craziness on the 1 year predictions? I'm guessing it has to do with the way my experiment was set up. I took 500 giants of the stock market (Actually I think I only have 497 of them or something like that), then I look backwards to when they were small companies. We already KNOW that they've bounced back from every low they've set. Also, a small company is more likely to plummet on bad news than, say, General Electric. Many people invested in GE are in it for the long haul and they ignore recent news entirely. That would make it more likely that a stock that is already a market giant and is setting new lows since 2005 is actually in real trouble. Perhaps the market IS overreacting to bad news, but that doesn't mean the company is in good shape.
Or maybe I'm just crazy. Now I need to program some other measurements, like standard deviations and whatnot.
Stock Prediction Results
So I worked on my stock analysis program over the weekend, and I kind of took two steps back in order to take one step forward. But now I've got a much more flexible base for testing ideas.
As a test of my program, I created an indicator. The indicator returns a value from 0 to 99, indicating where the stock is in terms of the window created by the 52 week high and the 52 week low. If the stock is setting new highs, it would read 99. If the stock was hitting new lows, it would read 0. Halfway in between the two would read 50.
Now I wrote an analysis class that goes through all the historical data for a list of stocks (in my case, I just used the S&P 500 list), finds the indicator reading, then notes where the stock is in 1 month, 3 months, 6 months, and a year. Now without any guesswork from me, it knows how a stock setting a new low would perform compared to a stock setting a new high. And it can also compare those to any other value the indicator would give.
The answer to the setting new lows vs setting new highs comparison is not intuitive. I would assume that a stock setting new highs is doing great, they're making money, everything they touch turns to gold... Stocks that are setting new lows are coming apart at the seams. But the stock setting new lows will perform much better on average in any of the four time frames I chose.
I suppose it does make an inverted sort of sense -- The market takes into account not only what you're doing now, but what you're expected to do in the next year or years. Having everything you touch turn to gold is a tough thing to keep doing. The first sign of a falter and the stock drops. But a company that's doing lousy in every way? Well, all they have to do is look like MAYBE they'll turn things around and their stock will soar!
Another interpretation is another market truism. The market hates uncertainty. You pay a premium for a stock perceived as 'safe'. People REALLY don't want to lose their ass when they're invested, so a company with low downside is priced to reflect it. So for a stock that's in trouble, the inverse is probably true. Those safety-loving investors are jumping ship and they're willing to sell at a discount.
Now there are some problems with my example... I used S&P 500 stocks. S&P 500 stocks are all wildly successful compared to the market at large, and we already know that they're CURRENTLY wildly successful. So if IBM set a new low in 1967, we know it recovered because it's kicking ass today. My little model doesn't take into account all those stocks that set new lows and went on to go out of business, or get bought out, etc. because they aren't in the S&P 500 today. Basically, IBM setting a new low today doesn't mean the same thing as IBM setting a new low in 1967.
So I wrote a forward tester . What it did is to use all the data for stocks up to 2005 as a base to make predictions, then made predictions for all the stocks from 2005 to May 4, 2006. The graph above is the results. The X axis is the prediction made, and the Y axis is the average actual result for that prediction. The diaganol line is where the predictions exactly match the average return.
The red dots on the bottom left are my 1 month predictions. As you can see, while they don't perfectly follow the line, they do seem to follow the model pretty well. The yellow dots are my 3 month predictions. They also seem to predict reasonably accurately. The green dots are my 6 months predictions, and they also seem to do quite well. I was really quite surprised with the results thus far. I really expected the stocks at new lows to not behave as the model suggested.
But then all hell breaks loose. The blue dots are my predictions for 1 year. As you can see, they're all over the place, and they actually seem to be the inverse of what my analyzer predicted!
I suppose there's a million ways to analyze this, but this is what I'm guessing it means:
The stock market overreacts to recent news. This is one of those truisms of contrarian investors, and it seems there may be some truth to it. If a stock is setting new highs, the recent news on that stock is almost certainly good. If a stock is setting new lows, then the recent news is almost certainly bad. In the middle, it's a crapshoot. So if the recent news is bad and the stock is setting new lows, it's probably undervalued. The stock will correct upwards over the next several months.. If the recent news is good, pushing stocks to new highs, then as the stock may be overvalued -- as soon as the good news stops, the stock will correct downward.
That explains my 1 month, 3 month, and 6 month predictions, but what's causing the craziness on the 1 year predictions? I'm guessing it has to do with the way my experiment was set up. I took 500 giants of the stock market (Actually I think I only have 497 of them or something like that), then I look backwards to when they were small companies. We already KNOW that they've bounced back from every low they've set. Also, a small company is more likely to plummet on bad news than, say, General Electric. Many people invested in GE are in it for the long haul and they ignore recent news entirely. That would make it more likely that a stock that is already a market giant and is setting new lows since 2005 is actually in real trouble. Perhaps the market IS overreacting to bad news, but that doesn't mean the company is in good shape.
Or maybe I'm just crazy. Now I need to program some other measurements, like standard deviations and whatnot.