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 (3125)1/19/1998 4:01:00 PM
From: Jeff Grover  Read Replies (4) | Respond to of 11149
 
Brooke,

I beleive the scan below will solve your dilemma. I've added another
for loop that eliminated over 30 lines of code and makes it usable
for virtually any period of interest. I also introduced another
loop to print out multiple days of CCI values so I could compare
results with other sources.

Now maybe you (or someone) can help me with two questions:

-- Why does this scan work (agree with WOW) when the equation for
Typical Price is expressed as "(H + L + C)/periods" although my
TA from A to Z book says it should be "(H + L + C)/3"?, and

-- Can anyone point me to our prior discussion WRT different CCI
calculations (MSwin has two and WoW has a third, none of which
appears to be the same)? ... Harold, do you recall it?

.... which tread or e-mail list should I read from the begining?<g>

//CCI(n) -- calculate CCI(n) for arbitrary n
//
// *** agrees with WOW although I don't understand why
// -- JL Grover, 1-19-98
//
input="one.lst";
output="ccivar.lst";

daystoload = 250;

float periods, cci, first, second, total, B, aa;
integer days,dday,d;

periods:=13; // set to any old number you want

for dday = -10 to 0 step 1 do
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);

println dday," , ",cci;
next dday;

// Println Symbol, ": ", cci:8:2;