Gale, Here's a scan that gives the slope of Dahl for two periods -- whatever periods you want. You could try all sorts of systems with it; e.g., buying when the 3-day slope reaches a certain value and selling when the 13-day slope falls to a given point; or buying when the 3-day slope of Dahl rises above the 34-day slope of Dahl. With Wow or Metastock, you could profit test your ideas. Good, wholesome fun -- huh?
One slope is dalslope and the other, dalslopeb. So you could set dalslope for 3 periods, let's say, and dalsopeb for 13 periods. Then you could write something like if dalslope>dalslopeb then println Symbol, BUY; or if dalslope>.01, buy, and if dalslopeb<.06, sell. using different periods for dalslope and dalsopeb. It's just a crazy idea -- not based on any tried and true formulas for profit-testing systems.
//Two-period slope of Dahl by Brooke Elise Nagler, //Using Bob Jagow's QP formula for slope
output = "dalslopes.lst"; input = "portfoli.lst"; issuetype common; Daystoload = 500;
float f, q, dalslope, Sxy, Sy, fb, qb, dalslopeb, Sxyb, Syb; integer S, Sx, Sxx, i, j, r, Sb, Sxb, Sxxb, ib, jb, rb;
S := 3; //S is the number of days for the slope of dalslope
f:=0; q:=0; for j=0 to -(S-1) step -1 do f := f + (MovAvg(j,50,cl)- MovAvg(j-15,50,cl)); next j; for r=0 to -(S-1) step -1 do q := q+(r*(MovAvg(r,50,cl)-MovAvg(r-15,50,cl))); next r; Sx := 0; Sxx := 0; //Sxy := 0; //Sy := 0; for i = 1 - S to 0 do Sx := Sx + i; Sy := f; Sxx := Sxx + i*i; Sxy := q; next i; dalslope := (S*Sxy - Sx*Sy)/(S*Sxx - Sx*Sx);
Sb := 13; //Sb is the number of days for the slope of dalslopeb
fb:=0; qb:=0; for jb=0 to -(Sb-1) step -1 do fb := fb + (MovAvg(jb,50,cl)- MovAvg(jb-15,50,cl)); next jb; for rb=0 to -(Sb-1) step -1 do qb := qb+(rb*(MovAvg(rb,50,cl)-MovAvg(rb-15,50,cl))); next rb; Sxb := 0; Sxxb := 0; //Sxyb := 0; //Syb := 0; for ib = 1 - Sb to 0 do Sxb := Sxb + ib; Syb := fb; Sxxb := Sxxb + ib*ib; Sxyb := qb; next ib; dalslopeb := (Sb*Sxyb - Sxb*Syb)/(Sb*Sxxb - Sxb*Sxb);
println symbol,",",close(0):8:2,",",dalslope:8:4,",",dalslopeb:8:4; |