To: Bob Jagow who wrote (3141 ) 1/19/1998 6:39:00 PM From: TechTrader42 Read Replies (2) | Respond to of 11149
I know this is getting out of hand, kids -- all these Brobdingnagian scans -- but here's a slope of CCI scan using the new variable formula for CCI. So you can get the 3-day slope of CCI with this scan, with any period for CCI. Values turn out to be basically the same as those with the slope of CCI scan I posted earlier. It's a long scan,but for some odd reason, it does run: //3-day slope of CCI (variable periods) output="ccislope.lst"; daystoload = 250; float periods, cci, cciprev, cciprev2, cciprev3, slope, slopeprev, Sxy, Sxyb, Sy, Syb, first, second, total, B, aa; integer days, dday, d, ia, Sa, Sx, Sxx; periods:=13; // set to any old number you want; this is the period for CCI dday := 0; B :=(high(dday)+low(dday)+close(dday))/periods; aa:=0; for days=dday to dday-(periods-1) step -1 do aa:=aa+((high(days)+low(days)+close(days))/periods)/periods; next days; second:=0; first:=0; total:=0; for days=dday to dday-(periods-1) step -1 do second :=0; for d = days to days-(periods-1) step -1 do second := second + ((high(d)+close(d)+low(d))/periods)/periods; next d; first:=(high(days)+low(days)+close(days))/periods; total:=total+abs(first-second); next days; cci:=(B-aa)/(0.015*(total)/periods+.00001); dday := -1; B :=(high(dday)+low(dday)+close(dday))/periods; aa:=0; for days=dday to dday-(periods-1) step -1 do aa:=aa+((high(days)+low(days)+close(days))/periods)/periods; next days; second:=0; first:=0; total:=0; for days=dday to dday-(periods-1) step -1 do second :=0; for d = days to days-(periods-1) step -1 do second := second + ((high(d)+close(d)+low(d))/periods)/periods; next d; first:=(high(days)+low(days)+close(days))/periods; total:=total+abs(first-second); next days; cciprev:=(B-aa)/(0.015*(total)/periods+.00001); dday := -2; B :=(high(dday)+low(dday)+close(dday))/periods; aa:=0; for days=dday to dday-(periods-1) step -1 do aa:=aa+((high(days)+low(days)+close(days))/periods)/periods; next days; second:=0; first:=0; total:=0; for days=dday to dday-(periods-1) step -1 do second :=0; for d = days to days-(periods-1) step -1 do second := second + ((high(d)+close(d)+low(d))/periods)/periods; next d; first:=(high(days)+low(days)+close(days))/periods; total:=total+abs(first-second); next days; cciprev2:=(B-aa)/(0.015*(total)/periods+.00001); dday := -3; B :=(high(dday)+low(dday)+close(dday))/periods; aa:=0; for days=dday to dday-(periods-1) step -1 do aa:=aa+((high(days)+low(days)+close(days))/periods)/periods; next days; second:=0; first:=0; total:=0; for days=dday to dday-(periods-1) step -1 do second :=0; for d = days to days-(periods-1) step -1 do second := second + ((high(d)+close(d)+low(d))/periods)/periods; next d; first:=(high(days)+low(days)+close(days))/periods; total:=total+abs(first-second); next days; cciprev3:=(B-aa)/(0.015*(total)/periods+.00001); Sa := 3; Sx := 0; Sxx := 0; //Sxy := 0; //Sy := 0; for ia = 1 - Sa to 0 do Sx := Sx + ia; Sy := cci + cciprev + cciprev2; Syb:= cciprev + cciprev2 + cciprev3; Sxx := Sxx + ia*ia; Sxy := (0*cci)+(-1*cciprev)+(-2*cciprev2); Sxyb := (0*cciprev)+(-1*cciprev2)+(-2*cciprev3); next ia; slope := (Sa*Sxy - Sx*Sy)/(Sa*Sxx - Sx*Sx); slopeprev := (Sa*Sxyb - Sx*Syb)/(Sa*Sxx - Sx*Sx); println Symbol, " , ", slope, " , ", slopeprev;