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: Bob Jagow who wrote (3023)1/13/1998 11:30:00 PM
From: Paul Beattie  Read Replies (1) | Respond to of 11149
 
Bob,

Thanks very much for this work. I'm catching up after earlier problems getting into SI threads. What amazes me is how steadily the discussion in this thread moved toward QP code for slope and linear regression.

Timeseries Moving Average is now available to us in QP2, thanks to you, because we can calculate Timeseries Regression values using your code as a base. You've made me a happy camper. I won't get to it until the weekend, but I'll work on an 89TS scan then.

Great work!
Paul



To: Bob Jagow who wrote (3023)1/14/1998 1:08:00 AM
From: TechTrader42  Read Replies (1) | Respond to of 11149
 
Bob: Here's a QP translation of a system I occasionally use in Window on Wall Street -- a translation that makes use of your brilliant QP formula for a linear regression slope. It's based on percentage jumps in price. It works best with low-cap stocks. The slope of Dahl is in there to prevent buying after up days when a stock is trending down. It ain't the Holy Grail, but it finds some nice picks.

//Brooke's Percentage System

output = "bps.lst";
input = "portfoli.lst";
issuetype common;
Daystoload = 500;

//dahl: mov(c,days,simp) - ref(mov(c,days,simp),-15)

float a, b, c, d, e, f, dahl, prevdahl, nextdahl, dalslope, Sxy, Sy;
integer i, S, Sx, Sxx;

a := movavg(0,50,cl) ;
b := movavg(-15,50,cl) ;
c := movavg(-1,50,cl) ;
d := movavg(-16,50,cl) ;
e := movavg(-2,50,cl) ;
f := movavg(-17,50,cl) ;

dahl := (a-b);
prevdahl := (c-d);
nextdahl := (e-f);

S := 3;
Sx := 0;
Sxx := 0;
//Sxy := 0;
//Sy := 0;
for i = 1 - S to 0 do
Sx := Sx + i;
Sy := dahl + prevdahl + nextdahl;
Sxx := Sxx + i*i;
Sxy := (0*dahl)+(-1*prevdahl)+(-2*nextdahl);
next i;
dalslope := (S*Sxy - Sx*Sy)/(S*Sxx - Sx*Sx);

if close(0)>1.03*close(-1) and
dalslope>0 then
println symbol:-6," BUY: Close: ", close(0):-6:3, ",", " Up: ", close(0)-close(-1):4:3, ","," Volume: ", vol(0):-10, ",", " QRS: ", QRS(0):2, ","," Sharesfloat: ", Sharesfloat:6:3, ", ",Description:-12;
endif;

*********************************

Here's is a formula for the 3-day slope of Dahl's Primary Trend, which uses Bob's QP formula for slope. Incrediby, it gives the same values as WOW for the slope of Dahl (thank you Bob for the slope formula!):

//3-day Slope of Dahl's Primary Trend, applying Bob Jagow's
//slope formula to Brooke's Dahl formula
output = "dalslope.lst";

issuetype common;
Daystoload = 500;

//Dahl: mov(c,days,simp) - ref(mov(c,days,simp),-15)

float a, b, c, d, e, f, dahl, prevdahl, nextdahl, slope, Sxy, Sy;
integer i, S, Sx, Sxx;

a := movavg(0,50,cl) ;
b := movavg(-15,50,cl) ;
c := movavg(-1,50,cl) ;
d := movavg(-16,50,cl) ;
e := movavg(-2,50,cl) ;
f := movavg(-17,50,cl) ;

dahl := (a-b);
prevdahl := (c-d);
nextdahl := (e-f);

S := 3;
Sx := 0;
Sxx := 0;
//Sxy := 0;
//Sy := 0;
for i = 1 - S to 0 do
Sx := Sx + i;
Sy := dahl + prevdahl + nextdahl;
Sxx := Sxx + i*i;
Sxy := (0*dahl)+(-1*prevdahl)+(-2*nextdahl);
next i;
slope := (S*Sxy - Sx*Sy)/(S*Sxx - Sx*Sx);
println symbol,",",close(0):8:2,",",slope:8:2;

****************

That scan is based on Bob Jagow's simple and elegant translation of the MSWIN linear regression formula for slope:

//Slope, formulated by Bob Jagow

output = "slopebob.lst";

issuetype common;
Daystoload = 50; //needed for R2 bug!!!
integer i, S, Sx, Sxx;
float b, Sxy, Sy;
S := 2;
Sx := 0;
Sxx := 0;
Sxy := 0;
Sy := 0;
for i = 1 - S to 0 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);
println symbol,",",close(0):8:2,",",b:8:2;

*******************

That's it folks. No more linear regressions or linear obsessions for the time being.

Brooke