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: TechTrader42 who wrote (3152)1/19/1998 9:17:00 PM
From: TechTrader42  Respond to of 11149
 
Here's the variable-CCI slope scan corrected, too, with "3" instead of "periods"
where necessary. I know you all needed it tonight, so I'm rushing it out:

output="ccivar.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))/3;

aa:=0;
for days=dday to dday-(periods-1) step -1 do
aa:=aa+((high(days)+low(days)+close(days))/3)/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))/3)/periods;
next d;
first:=(high(days)+low(days)+close(days))/3;
total:=total+abs(first-second);
next days;

cci:=(B-aa)/(0.015*(total)/periods+.00001);

dday := -1;
B :=(high(dday)+low(dday)+close(dday))/3;

aa:=0;
for days=dday to dday-(periods-1) step -1 do
aa:=aa+((high(days)+low(days)+close(days))/3)/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))/3)/periods;
next d;
first:=(high(days)+low(days)+close(days))/3;
total:=total+abs(first-second);
next days;

cciprev:=(B-aa)/(0.015*(total)/periods+.00001);

dday := -2;
B :=(high(dday)+low(dday)+close(dday))/3;

aa:=0;
for days=dday to dday-(periods-1) step -1 do
aa:=aa+((high(days)+low(days)+close(days))/3)/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))/3)/periods;
next d;
first:=(high(days)+low(days)+close(days))/3;
total:=total+abs(first-second);
next days;

cciprev2:=(B-aa)/(0.015*(total)/periods+.00001);

dday := -3;
B :=(high(dday)+low(dday)+close(dday))/3;

aa:=0;
for days=dday to dday-(periods-1) step -1 do
aa:=aa+((high(days)+low(days)+close(days))/3)/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))/3)/periods;
next d;
first:=(high(days)+low(days)+close(days))/3;
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, " , ", cci, " , ", slope, " , ", slopeprev;