原码奉上:
{CCI}
TT:=IF(ISLASTBAR,240/FROMOPEN,1);
NN:=120;
HH:=HHV(V*TT,NN);
LL:=LLV(V,NN);
最高:=CONST(HH);
最低:=CONST(LL);
最高2:=CONST(HHV(H,NN));
最低2:=CONST(LLV(L,NN));
PP:=IF((最高2*0.9-(最高2-最低2)*0.5)>CONST(LLV(L,20)),0.9,IF((最高2*0.9-(最高2-最低2)*0.5)>CONST(LLV(L,50)),0.7,0.6)),NODRAW;
RCC1:=最高2*0.85-(最高2-最低2)*PP;
最低3:=MIN(RCC1,最低2);
AAD:=最低3;
{CCI}
M:=14;
N:=20;
TYP := (HIGH + LOW + CLOSE)/3;
WCCI:=(TYP-MA(TYP,N))/(0.015*AVEDEV(TYP,N)),COLORWHITE,LINETHICK2;
CCI:=(TYP-MA(TYP,M))/(0.015*AVEDEV(TYP,M)),COLOR008000;
ARRAY:=CCI;
HIGHBARS:=BARSLAST(NOT(ARRAY>0));
LOWBARS:=BARSLAST(NOT(ARRAY<0));
UPCONDITION:=BARSLAST(HIGHBARS>=6 AND SUM(ARRAY>100,5)>0);
DNCONDITION:=BARSLAST(LOWBARS>=6 AND SUM(ARRAY<-100,5)>0);
UPTREND:=ARRAY>0 AND UPCONDITION
TRTREND:=HIGHBARS>=5 AND NOT(UPTREND) OR LOWBARS>=5 AND NOT(DNTREND);
{蓝色}
STICKLINE(UPTREND,AAD+CCI/500,AAD,3,0),COLORFF2200;
STICKLINE(UPTREND,AAD+CCI/500,AAD,2,0),COLORFF4400;
STICKLINE(UPTREND,AAD+CCI/500,AAD,1,0),COLORFF6600;
STICKLINE(UPTREND,AAD+CCI/500,AAD,0.1,0),COLORFF8800;
{绿色}
STICKLINE(DNTREND,AAD+CCI/500,AAD,3,0),COLOR004400;
STICKLINE(DNTREND,AAD+CCI/500,AAD,2,0),COLOR008800;
STICKLINE(DNTREND,AAD+CCI/500,AAD,1,0),COLOR00AA00;
STICKLINE(DNTREND,AAD+CCI/500,AAD,0.1,0),COLOR00CC00;
{紫色}
STICKLINE(TRTREND,AAD+CCI/500,AAD,3,0),COLORFF0055;
STICKLINE(TRTREND,AAD+CCI/500,AAD,2,0),COLORFF0077;
STICKLINE(TRTREND,AAD+CCI/500,AAD,1,0),COLORFF0099;
STICKLINE(TRTREND,AAD+CCI/500,AAD,0.1,0),COLORFF00FF;
STICKLINE(NOT(UPTREND OR DNTREND OR TRTREND),AAD+CCI/500,AAD,3,0),COLOR003333;
STICKLINE(NOT(UPTREND OR DNTREND OR TRTREND),AAD+CCI/500,AAD,2,0),COLOR004444;
STICKLINE(NOT(UPTREND OR DNTREND OR TRTREND),AAD+CCI/500,AAD,2,0),COLOR005555;
STICKLINE(NOT(UPTREND OR DNTREND OR TRTREND),AAD+CCI/500,AAD,0.1,0),COLOR00FFFF;