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: Jeff Grover who wrote (3135)1/19/1998 4:36:00 PM
From: TechTrader42  Respond to of 11149
 
You did it! O frabjous day! You have to put // in front of
println dday," , ",cci (near the end), so it does't print out all
that junk. I'll try to figure out why you don't need the /3 in
there, though it may remain a mystery. It's as you say: the values
do match those in WOW, and in your earlier formula.

Speaking of which.......

Here's a scan for the 3-day slope of CCI(13) for today and the previous
day. Values match those in WOW, give or take a few tenths of a point.
I chose a 3-day slope because I've got BNS in my sights, and BNS looks
for quick changes in direction. I don't think you'd want a longer
period for slope in this case.

Oh, back to the variable CCI scan for a second: Have you noticed
how slowly it runs? I wonder why that is. So far QP has kept up
with our madness, but this latest CCI scan really hobbles it.

Anyway, here's the slope of CCI:

//3-day slope for cci (13) for today and previous day
//based on John Sugas' formula for cci
//and Bob Jagow's formula for slope

output="ccicross.lst";

issuetype=common;
exchange nyse,nasdaq,amex;
daystoload = 250;

Integer ia, Sa, Sx, Sxx;
float cci, cciprev, cciprev2, cciprev3, slope, slopeprev, Sxy, Sxyb, Sy, Syb, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, Za, Zb, Zc, aa, bb, cc, dd, ee, ff, gg, hh, ii, jj, kk, ll, mm, nn, oo, pp;

B :=(high(0)+low(0)+close(0))/3 ;
C :=(high(-1)+low(-1)+close(-1))/3 ;
D :=(high(-2)+low(-2)+close(-2))/3 ;
E :=(high(-3)+low(-3)+close(-3))/3 ;
F :=(high(-4)+low(-4)+close(-4))/3 ;
G :=(high(-5)+low(-5)+close(-5))/3 ;
H :=(high(-6)+low(-6)+close(-6))/3 ;
I :=(high(-7)+low(-7)+close(-7))/3 ;
J :=(high(-8)+low(-8)+close(-8))/3 ;
K :=(high(-9)+low(-9)+close(-9))/3 ;
L :=(high(-10)+low(-10)+close(-10))/3 ;
M :=(high(-11)+low(-11)+close(-11))/3 ;
N :=(high(-12)+low(-12)+close(-12))/3 ;
O :=(high(-13)+low(-13)+close(-13))/3 ;
P :=(high(-14)+low(-14)+close(-14))/3 ;
Q :=(high(-15)+low(-15)+close(-15))/3 ;
R :=(high(-16)+low(-16)+close(-16))/3 ;
S :=(high(-17)+low(-17)+close(-17))/3 ;
T :=(high(-18)+low(-18)+close(-18))/3 ;
U :=(high(-19)+low(-19)+close(-19))/3 ;
V :=(high(-20)+low(-20)+close(-20))/3 ;
W :=(high(-21)+low(-21)+close(-21))/3 ;
X :=(high(-22)+low(-22)+close(-22))/3 ;
Y :=(high(-23)+low(-23)+close(-23))/3 ;
Z :=(high(-24)+low(-24)+close(-24))/3 ;
Za :=(high(-25)+low(-25)+close(-25))/3 ;
Zb :=(high(-26)+low(-26)+close(-26))/3 ;
Zc :=(high(-27)+low(-27)+close(-27))/3 ;
aa :=(B+C+D+E+F+G+H+I+J+K+L+M+N)/13 ;
bb :=(C+D+E+F+G+H+I+J+K+L+M+N+O)/13 ;
cc :=(D+E+F+G+H+I+J+K+L+M+N+O+P)/13 ;
dd :=(E+F+G+H+I+J+K+L+M+N+O+P+Q)/13 ;
ee :=(F+G+H+I+J+K+L+M+N+O+P+Q+R)/13 ;
ff :=(G+H+I+J+K+L+M+N+O+P+Q+R+S)/13 ;
gg :=(H+I+J+K+L+M+N+O+P+Q+R+S+T)/13 ;
hh :=(I+J+K+L+M+N+O+P+Q+R+S+T+U)/13 ;
ii :=(J+K+L+M+N+O+P+Q+R+S+T+U+V)/13 ;
jj :=(K+L+M+N+O+P+Q+R+S+T+U+V+W)/13 ;
kk :=(L+M+N+O+P+Q+R+S+T+U+V+W+X)/13 ;
ll :=(M+N+O+P+Q+R+S+T+U+V+W+X+Y)/13 ;
mm :=(N+O+P+Q+R+S+T+U+V+W+X+Y+Z)/13 ;
nn :=(O+P+Q+R+S+T+U+V+W+X+Y+Z+Za)/13 ;
oo :=(P+Q+R+S+T+U+V+W+X+Y+Z+Za+Zb)/13 ;
pp :=(Q+R+S+T+U+V+W+X+Y+Z+Za+Zb+Zc)/13 ;

cci := (B-aa)/(0.015*(abs(B-aa)+abs(C-bb)+abs(D-cc)+abs(E-dd)+abs(F-ee)+abs(G-ff)+abs(H-gg)+abs(I-hh)+abs(J-ii)+abs(K-jj)+abs(L-kk)+abs(M-ll)+abs(N-mm))/13)+.00001;
cciprev := (C-bb)/(0.015*(abs(C-bb)+abs(D-cc)+abs(E-dd)+abs(F-ee)+abs(G-ff)+abs(H-gg)+abs(I-hh)+abs(J-ii)+abs(K-jj)+abs(L-kk)+abs(M-ll)+abs(N-mm)+abs(O-nn))/13)+.00001;
cciprev2 := (D-cc)/(0.015*(abs(D-cc)+abs(E-dd)+abs(F-ee)+abs(G-ff)+abs(H-gg)+abs(I-hh)+abs(J-ii)+abs(K-jj)+abs(L-kk)+abs(M-ll)+abs(N-mm)+abs(O-nn)+abs(P-oo))/13)+.00001;
cciprev3 := (E-dd)/(0.015*(abs(E-dd)+abs(F-ee)+abs(G-ff)+abs(H-gg)+abs(I-hh)+abs(J-ii)+abs(K-jj)+abs(L-kk)+abs(M-ll)+abs(N-mm)+abs(O-nn)+abs(P-oo)+abs(Q-pp))/13)+.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:", cci:8:2, ", CCIPREV:", cciprev:8:2, ", SLOPE:",slope:8:3, ", SLOPEPREV:",slopeprev:8:3;



To: Jeff Grover who wrote (3135)1/19/1998 5:06:00 PM
From: TechTrader42  Read Replies (1) | Respond to of 11149
 
Jeff: That divide-by-three mystery has me stumped. I originally had 3 in there and changed it for some reason that now escapes me. Eliot sent me results for Metastock, by the way, and they're very close to those in WOW -- the discrepancies are insignificant. So both programs would appear to be using similar formulas, and we're getting the same results when dividing the high, low and close by periods, not by 3. If you do divide by 3 in the QP formula, you get results that don't even look like CCI values. Maybe we should ask someone at Wow or Metastock. You've unearthed a real mystery.

Brooke



To: Jeff Grover who wrote (3135)1/19/1998 5:17:00 PM
From: TechTrader42  Respond to of 11149
 
Thanks for solving the riddle of "second" with this for loop:

for d = days to days-(periods-1) step -1 do
second := second + ((high(d)+close(d)+low(d))/periods)/periods;
next d;

And thanks for adding dday. That is brilliant. Now it prints out the value of CCI for each stock for the past 10 days. No wonder the scan takes so long. Forgive me for saying that line needs the double backslashes. You should do that only if you want to get just one day's CCI, of course.

It's quite a scan now.

Btw, I added Symbol to the Println here:

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

Brooke



To: Jeff Grover who wrote (3135)1/19/1998 5:39:00 PM
From: TechTrader42  Respond to of 11149
 
Jeff: Also, I reversed things here, so the output gives the most recent CCI first:

for dday = 0 to -10 step -1 do
B :=(high(dday)+low(dday)+close(dday))/periods;

Brooke