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

 Public ReplyPrvt ReplyMark as Last ReadFilePrevious 10Next 10PreviousNext  
To: Bob Jagow who wrote (3073)1/15/1998 5:06:00 PM
From: TechTrader42   of 11149
 
Bob: Here is the "Sy" part of the dahl slope formula with the
for loop. The "Sxy" part is presenting difficulties, to say
the least.

f:=0;
for j=0 to -2 step -1
do
f := f + MovAvg(j,50,cl);
next j;

z:=0;
for k=-15 to -17 step -1
do
z := z + MovAvg(k,50,cl);
next k;

Sy := (f-z);

That works well, and the output is correct.

For the Sxy part, I've been playing with something like this:

q:=0;
for r=0 to -2 step -1
do
q := q+(r*(MovAvg(r,50,cl)-MovAvg(k,50,cl)));
next r;

But it doesn't give the right values, maybe because there's no "next
k" in there. But QP won't accept another next k. I've tried combining everything into one for loop, but either I get errors, or the values aren't right.

I've tried all sorts of formulas, but none checks against the
original value of Sxy with the longer formula (that value is the
same as the value given by WOW). Theoretically, the for loop above
would work, if r and k did their stuff and got moving.

Sxy, remember, is: (0*dahl)+(-1*dahla)+(-2*dahlb);

where:

dahl := (aa-bb);
dahla := (cc-dd);
dahlb := (ee-ff);

and:

aa := movavg(0,50,cl) ;
bb := movavg(-15,50,cl) ;
cc := movavg(-1,50,cl) ;
dd := movavg(-16,50,cl) ;
ee := movavg(-2,50,cl) ;
ff := movavg(-17,50,cl) ;

Brooke

The whole long formula for the slope of dahl was:

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

//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:4;
Report TOU ViolationShare This Post
 Public ReplyPrvt ReplyMark as Last ReadFilePrevious 10Next 10PreviousNext