M:=14;Q:=6;N:=20;
TYP := (HIGH + LOW + CLOSE)/3;
CCI:(TYP-MA(TYP,M))/(0.015*AVEDEV(TYP,M)),STICK,COLORRED;
WCCI:(TYP-MA(TYP,M))/(0.015*AVEDEV(TYP,M)),COLORWHITE,LINETHICK2;
DRAWICON((ABS(CCI) >= 200),CCI,12);
TCCI:(TYP-MA(TYP,N))/(0.015*AVEDEV(TYP,N)),COLORRED;
EMA34:=EMA(CLOSE,34);
PARTLINE((CLOSE >= EMA34),100),COLORRED;
PARTLINE((CLOSE >=EMA34 ),(0 - 100)),COLORGREEN;
PARTLINE((CLOSE < EMA34),100),COLORGREEN;
PARTLINE((CLOSE < EMA34),(0 - 100)),COLORGREEN;
前差值:ABS(REF(CCI,1)-REF(CCI,2)),LINETHICK0;
差值:ABS(REF(CCI,1)-CCI),LINETHICK0;
200,COLORFFFF00;
-200,COLORFFFF00;
100,COLORFFFF00;
-100,COLORFFFF00;
PI:=ATAN(1)*4;
PERIODS:=30;
HIGHHIGH:=HHV(HIGH,PERIODS);
LOWLOW:=LLV(LOW,PERIODS);
RANGEV:=25/(HIGHHIGH-LOWLOW)*LOWLOW;
EM34:=EMA(CLOSE,34);
X1_EMA34:=0;
X2_EMA34:=1;
Y1_EMA34:=0;
X1_LSMA25:=0;
X2_LSMA25:=1;
Y1_LSMA25:=0;
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<DNCONDITION;
DNTREND:=ARRAY<0 AND UPCONDITION>DNCONDITION;
TRTREND:=HIGHBARS>=5 AND NOT(UPTREND) OR LOWBARS>=5 AND NOT(DNTREND);
STICKLINE(UPTREND,0,CCI,3,0),COLORFF0000;
STICKLINE(DNTREND,0,CCI,3,0),COLORRED;
STICKLINE(TRTREND,0,CCI,3,0),COLORYELLOW;
STICKLINE(NOT(UPTREND OR DNTREND OR TRTREND),0,CCI,3,0),COLOR808080;{灰色}
DRAWICON(ABS(CCI)>=200,CCI,12);
STIME:=TIMETOT0(CURRENTTIME);
通达信
STICKLINE(C,320,-320,5,0),COLOR80A16F,NODRAW;
M:=14;Q:=6;N:=20;
MM:=IF(PERIOD=1,M,IF(PERIOD=2,M,IF(PERIOD=3,M,IF(PERIOD=4,M,IF(PERIOD=5,M,IF(PERIOD=6,Q,IF(PERIOD=7,Q,IF(PERIOD=8,Q,0))))))));
AVG:=(HIGH+LOW+CLOSE)/3;
CCI:=(AVG-MA(AVG,MM))/(0.015*AVEDEV(AVG,MM));
DIF:CCI-REF(CCI,1),LINETHICK0,COLOR00FF00;
前差值:ABS(REF(CCI,1)-REF(CCI,2)),NODRAW;
差值20:IF(DIF>15 AND DIF<120,DIF,0),NODRAW,COLOR0000FF;
PI:=ATAN(1)*4;
PERIODS:=30;
HIGHHIGH:=HHV(HIGH,PERIODS);
LOWLOW:=LLV(LOW,PERIODS);
RANGEV:=25/(HIGHHIGH-LOWLOW)*LOWLOW;
EMA20:=EMA(CLOSE,20);
X1_EMA20:=0;
X2_EMA20:=1;
Y1_EMA20:=0;
Y2_EMA20:=(REF(EMA20,1)-EMA20)/AVG*RANGEV;
C_EMA20:=SQRT((X2_EMA20-X1_EMA20)*(X2_EMA20-X1_EMA20)+(Y2_EMA20-Y1_EMA20)*(Y2_EMA20-Y1_EMA20));
ANGLE_EMA20V:=ROUND(ABS(180*ACOS((X2_EMA20-X1_EMA20)/C_EMA20)/PI));
ANGLE_EMA20:=IF(Y2_EMA20>0,-ANGLE_EMA20V,ANGLE_EMA20V);
LSMA25:=FORCAST(CLOSE,25);
X1_LSMA25:=0;
X2_LSMA25:=1;
Y1_LSMA25:=0;
Y2_LSMA25:=(REF(LSMA25,1)-LSMA25)/AVG*RANGEV;
C_LSMA25:=SQRT((X2_LSMA25-X1_LSMA25)*(X2_LSMA25-X1_LSMA25)+(Y2_LSMA25-Y1_LSMA25)*(Y2_LSMA25-Y1_LSMA25));
ANGLE_LSMA25V:=ROUND(ABS(180*ACOS((X2_LSMA25-X1_LSMA25)/C_LSMA25)/PI));
ANGLE_LSMA25:=IF(Y2_LSMA25>0,-ANGLE_LSMA25V,ANGLE_LSMA25V);
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<DNCONDITION;
DNTREND:=ARRAY<0 AND UPCONDITION>DNCONDITION;
TRTREND:=HIGHBARS>=5 AND NOT(UPTREND) OR LOWBARS>=5 AND NOT(DNTREND);
STICKLINE(UPTREND,0,CCI,1,0),COLORFF0000;
STICKLINE(DNTREND,0,CCI,1,0),COLOR0000FF;
STICKLINE(TRTREND,0,CCI,1,0),COLOR00FFFF;
STICKLINE(NOT(UPTREND OR DNTREND OR TRTREND),0,CCI,1,0),COLOR808080;
WCCI:CCI,LINETHICK1,COLORWHITE;
TCCI:(AVG-MA(AVG,N))/(0.015*AVEDEV(AVG,N)),COLOR7F00FF,LINETHICK2;
STICKLINE(ANGLE_EMA20>=5,-301,-321,2,0),COLORD0E040;
STICKLINE(ANGLE_EMA20<5 AND ANGLE_EMA20>=3.57,-301,-321,2,0),COLOR006400;
STICKLINE(ANGLE_EMA20<3.57 AND ANGLE_EMA20>=2.14,-301,-321,2,0),COLOR98FB98;
STICKLINE(ANGLE_EMA20<2.14 AND ANGLE_EMA20>=0.71,-301,-321,2,0),COLOR00FF00;
STICKLINE(ANGLE_EMA20<0.71 AND ANGLE_EMA20>-0.71,-301,-321,2,0),COLOR00FFFF;
STICKLINE(ANGLE_EMA20<=-0.71 AND ANGLE_EMA20>-2.14,-301,-321,2,0),COLORE0FFFF;
STICKLINE(ANGLE_EMA20<=-2.14 AND ANGLE_EMA20>-3.57,-301,-321,2,0),COLOR00A5FF;
STICKLINE(ANGLE_EMA20<=-3.57 AND ANGLE_EMA20>-5,-301,-321,2,0),COLOR0000FF;
STICKLINE(ANGLE_EMA20<=-5,-301,-321,2,0),COLOR00008B;
SW:=IF(ABS(ANGLE_EMA20)>=15 AND ABS(ANGLE_EMA20+ANGLE_LSMA25)>=50,IF(ANGLE_LSMA25>0,2,-2),IF(ABS(ANGLE_EMA20)>=0 AND (ANGLE_EMA20>=0 AND ANGLE_LSMA25>=0 OR ANGLE_EMA20<=0 AND ANGLE_LSMA25<=0) AND ABS(ANGLE_EMA20+ANGLE_LSMA25)>=5,IF(ANGLE_LSMA25>0,1,-1),0));
STICKLINE(ABS(SW)=2,301,321,2,0),COLOR00FF00;
STICKLINE(ABS(SW)=1,301,321,2,0),COLOR00FFFF;
STICKLINE(ABS(SW)=0,301,321,2,0),COLOR0000FF;
IF(CLOSE>LSMA25,0,DRAWNULL),LINETHICK3,COLOR00FF00;
IF(CLOSE<LSMA25,0,DRAWNULL),LINETHICK3,COLOR0000FF;
IF(CLOSE=LSMA25,0,DRAWNULL),LINETHICK3,COLOR00FFFF;
DRAWICON(ABS(CCI)>=200,CCI,12);
STICKLINE(C,200,200,1.5,0),COLORFFFF00;
STICKLINE(C,-200,-200,1.5,0),COLORFFFF00;
STICKLINE(C,100,100,1.5,0),COLORFFFF00;
STICKLINE(C,-100,-100,1.5,0),COLORFFFF00;
飞狐
input:M(14,3,40),N(6,3,30);
TYP := (HIGH + LOW + CLOSE)/3;
cci:(TYP-MA(TYP,M))/(0.015*AVEDEV(TYP,M)),STICK,colorgreen;
Wcci:(TYP-MA(TYP,M))/(0.015*AVEDEV(TYP,M)),colorblack,LINETHICK2;
DRAWICON((ABS(CCI) >= 200),CCI,12);
tcci:(TYP-MA(TYP,n))/(0.015*AVEDEV(TYP,n)),colorred;
EMA34:=EMA(CLOSE,34);
PARTLINE((CLOSE >= EMA34),100),colorFF00;
PARTLINE((CLOSE >=EMA34 ),(0 - 100)),colorFF00;
PARTLINE((CLOSE < EMA34),100),colorFF;
PARTLINE((CLOSE < EMA34),(0 - 100)),colorFF;
前差值:abs(ref(cci,1)-ref(cci,2)),LINETHICK0;
差值:ABS(ref(CCI,1)-CCI),LINETHICK0;
200,LINEDOT,colorFFFF00;
-200,LINEDOT,colorFFFF00;
100,LINEDOT,colorFFFF00;
-100,LINEDOT,colorFFFF00;
PI:=ATAN(1)*4;
PERIODS:=30;
HIGHHIGH:=HHV(HIGH,PERIODS);
LOWLOW:=LLV(LOW,PERIODS);
RANGEV:=25/(HIGHHIGH-LOWLOW)*LOWLOW;
EMA34:=EMA(CLOSE,34);
X1_EMA34:=0;
X2_EMA34:=1;
Y1_EMA34:=0;
LSMA25:=FORCAST(CLOSE,25);
X1_LSMA25:=0;
X2_LSMA25:=1;
Y1_LSMA25:=0;
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<DNCONDITION;
DNTREND:=ARRAY<0 AND UPCONDITION>DNCONDITION;
TRTREND:=HIGHBARS>=5 AND NOT(UPTREND) OR LOWBARS>=5 AND NOT(DNTREND);
STICKLINE(UPTREND,0,CCI,3,0),colorFF0000;
STICKLINE(DNTREND,0,CCI,3,0),colorFF;
STICKLINE(TRTREND,0,CCI,3,0),colorFFFF;
STICKLINE(NOT(UPTREND OR DNTREND OR TRTREND),0,CCI,3,0),color808080;
PARTLINE(CLOSE>LSMA25,0),LINETHICK3,colorFF00;
PARTLINE(CLOSE<LSMA25,0),LINETHICK3,colorFF;
PARTLINE(CLOSE=LSMA25,0),LINETHICK3,colorFFFF;
DRAWICON(ABS(CCI)>=200,CCI,12);
TM:=IF(DATATYPE=1,1,IF(DATATYPE=2,5,IF(DATATYPE=3,15,IF(DATATYPE=4,30,IF(DATATYPE=5,60,240)))));
ALERT1:=IF(DATATYPE=1,10,IF(DATATYPE=2,34,IF(DATATYPE=3,100,IF(DATATYPE=4,180,IF(DATATYPE=5,300,600)))));
TIMEFRAME:=TM;
ALERT:=ALERT1;
STIME:=TIMETOT0(CURRENTT |