I thought it would be useful to narrow the list to stocks with a minimum percentage gain in slope. For example, you could look for all stocks with at least a 1 percent gain in the 21-day slope. (This may not be the best level, of course, but I was just trying to get the coding before I thought about how much of an increase in slope I wanted). If you look at the output in the most recent version of the scan I sent, you'll see that it gives the percentage difference between "b1," which is the slope on the day listed with date(i), and "b," the slope on the day before that. You can run the scan to get an idea of what percentage gain might be greater than average. I could get percentage gain in the output, but I couldn't set it as a condition without running into "divide by zero" errors. Also, oddly, percentage gain in the conditional statements wasn't returning the right stocks, based on the value for pctgain in the output.
Brooke |