SI
SI
discoversearch

We've detected that you're using an ad content blocking browser plug-in or feature. Ads provide a critical source of revenue to the continued operation of Silicon Investor.  We ask that you disable ad blocking while on Silicon Investor in the best interests of our community.  If you are not using an ad blocker but are still receiving this message, make sure your browser's tracking protection is set to the 'standard' level.
Strategies & Market Trends : TA-Quotes Plus -- Ignore unavailable to you. Want to Upgrade?


To: Roy Yorgensen who wrote (5233)7/6/1998 11:58:00 PM
From: TechTrader42  Respond to of 11149
 
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



To: Roy Yorgensen who wrote (5233)7/7/1998 12:08:00 AM
From: TechTrader42  Respond to of 11149
 
Here's the version I'm using now, with pctgain in the output. Percentage gain is not yet a condition for the output, though. The output just gives the pctgain for all the stocks it finds with rising slope. Making pctgain a condition leads to d by z errors and other "anomalies," shall we say.

//Slope formula by Bob Jagow
//Back-testing version by Roy Yorgensen
output = "linregslope.lst";
input="portfoli.lst";
issuetype common;
//Daystoload = 50; //needed for R2 bug!!!
integer i,j, S, Sx, Sxx;
float b,b1, Sxy, Sy, pctgain;

b1:=0; // only initialized first time
for j = 0 to -10 step -1 do
// reset all variables at stat of next loop
S := 21;
Sx := 0;
Sxx := 0;
Sxy := 0;
Sy := 0;
for i = j+(1 - S) to j do
Sx := Sx + i;
Sy := Sy + close(i); //kills println wo d2ld
Sxx := Sxx + i*i;
Sxy := Sxy + i*close(i); //kills println wo d2ld
//Sxy := Sxy + i*close(0);
next i;
b := (S*Sxy - Sx*Sy)/(S*Sxx - Sx*Sx);

//pctgain:=abs((b1/b)-1);

if
j<0 and // eliminate first pass thru loop
b< b1 then
pctgain:=abs((b1/b)-1);
endif;

if
j<0 // eliminate first pass thru loop

and b< b1 then
println symbol,",", date(i),",",close(0):6:3,","," B: ",
b:4:3,","," B1: ", b1:4:3,","," Pctgain: ", pctgain:4:2;

b1:=b; // save current for next test
else
b1:=b; // must alway set ot last day's val
endif;
next j;