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: Jan Robert Wolansky who wrote (5201)7/5/1998 11:30:00 PM
From: TechTrader42  Read Replies (1) | Respond to of 11149
 
It isn't because the formula is already using a for loop. Lots of scans have nested loops. Someone will probably come up with the correct coding soon. I probably made errors in the way I nested the loops, among other things. The darn scan drove me loopy. I kept getting the wrong values for slope when I looked back 10 days with a for loop.

Brooke



To: Jan Robert Wolansky who wrote (5201)7/6/1998 2:33:00 PM
From: Roy Yorgensen  Read Replies (3) | Respond to of 11149
 
Jan & Brook, I'm not certain, but I think this will do what you are looking for. I don't know what the results mean, but the logic seems correct.

//Slope, Linear Regression Formula, by Bob Jagow

output = "linregslope.lst";

issuetype common;
Daystoload = 50; //needed for R2 bug!!!
integer i,j, S, Sx, Sxx;
float b,b1, Sxy, Sy;
b1:=0; // only initialized first time
for j = 0 to -10 step -1
DO
// reset all variables at stat of next loop
S := 14;
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);
if
j<0 and // eliminate first pass thru loop
b< b1
then
println symbol,",", date(i),",",close(0):8:2,",",b:8:4;
b1:=b; // save current for next test
else
b1:=b; // must alway set ot last day's val
endif;
next j;



To: Jan Robert Wolansky who wrote (5201)7/6/1998 9:54:00 PM
From: Roy Yorgensen  Read Replies (1) | Respond to of 11149
 
Jan & Brooke, Arctic Mike indicated (post # 5211) that some qualifiers maybe helpful, please see my post 5218? back to Mike

Roy