AVG:=(HIGH+LOW+CLOSE)/3;
CCI:=(AVG-MA(AVG,14))/(0.015*AVEDEV(AVG,14));
DIF:CCI-REF(CCI,1),COLORFF00FF;
前差值:ABS(REF(CCI,1)-REF(CCI,2));
差值20:IF(DIF 15 AND DIF 120,DIF,0);
200,colorred;
-200,colorgreen;
100,COLOR0055FF;
-100,colorcyan ;
PI:=ATAN(1)*4;
RANGEV:=25/(HHV(HIGH,30)-LLV(LOW,30))*LLV(LOW,30);
EMA34:=EMA(CLOSE,34);
Y2_EMA34:=(REF(EMA34,1)-EMA34)/AVG*RANGEV;
C_EMA34:=SQRT((1)*(1)+(Y2_EMA34)*(Y2_EMA34));
ANGLE_EMA34V:=ROUND(ABS(180*ACOS((1)/C_EMA34)/PI));
ANGLE_EMA34:=IF(Y2_EMA34 0,-ANGLE_EMA34V,ANGLE_EMA34V);
LSMA25:=FORCAST(CLOSE,25);
Y2_LSMA25:=(REF(LSMA25,1)-LSMA25)/AVG*RANGEV;
C_LSMA25:=SQRT(1+(Y2_LSMA25)*(Y2_LSMA25));
ANGLE_LSMA25V:=ROUND(ABS(180*ACOS((1)/C_LSMA25)/PI));
ANGLE_LSMA25:=IF(Y2_LSMA25 0,-ANGLE_LSMA25V,ANGLE_LSMA25V);
HIGHBARS:=BARSLAST(NOT(CCI
LOWBARS:=BARSLAST(NOT(CCI
UPCONDITION:=BARSLAST(HIGHBARS =6 AND SUM(CCI 100,5)
DNCONDITION:=BARSLAST(LOWBARS =6 AND SUM(CCI -100,5)
UPTREND:=CCI 0 AND UPCONDITION DNCONDITION;
DNTREND:=CCI 0 AND UPCONDITION DNCONDITION;
TRTREND:=HIGHBARS =5 AND NOT(UPTREND) OR LOWBARS =5 AND NOT(DNTREND);
STICKLINE(UPTREND,0,CCI,3,0),COLOR0055FF;
STICKLINE(DNTREND,0,CCI,3,0),colorblue;
STICKLINE(TRTREND,0,CCI,3,0),COLORFF0099;
STICKLINE(NOT(UPTREND OR DNTREND OR TRTREND),0,CCI,3,0),COLOR808080;
WCCI:CCI;
TCCI:(AVG-MA(AVG,5))/(0.015*AVEDEV(AVG,5));
STICKLINE(ANGLE_EMA34 =5,-301,-321,8,0),coloryellow;
STICKLINE(ANGLE_EMA34 5 AND ANGLE_EMA34 =3.57,-301,-321,8,0),coloryellow;
STICKLINE(ANGLE_EMA34 3.57 AND ANGLE_EMA34 =2.14,-301,-321,8,0),COLOR98FB98;
STICKLINE(ANGLE_EMA34 2.14 AND ANGLE_EMA34 =0.71,-301,-321,8,0),colorgreen;
STICKLINE(ANGLE_EMA34 0.71 AND ANGLE_EMA34 -0.71,-301,-321,8,0),colorgreen;
STICKLINE(ANGLE_EMA34 =-0.71 AND ANGLE_EMA34 -2.14,-301,-321,8,0),colorgreen;
STICKLINE(ANGLE_EMA34 =-2.14 AND ANGLE_EMA34 -3.57,-301,-321,8,0),colorgreen;
STICKLINE(ANGLE_EMA34 =-3.57 AND ANGLE_EMA34 -5,-301,-321,8,0),colorgreen;
STICKLINE(ANGLE_EMA34 =-5,-301,-321,8,0),colorgreen;
SW:=IF(ABS(ANGLE_EMA34) =15 AND ABS(ANGLE_EMA34+ANGLE_LSMA25) =50,IF(ANGLE_LSMA25 0,2,-2),IF(ABS(ANGLE_EMA34) =0 AND (ANGLE_EMA34 =0 AND ANGLE_LSMA25 =0 OR ANGLE_EMA34 =0 AND ANGLE_LSMA25 =0) AND ABS(ANGLE_EMA34+ANGLE_LSMA25) =5,IF(ANGLE_LSMA25 0,1,-1),0));
STICKLINE(ABS(SW)=2,301,321,8,0),colorred;
STICKLINE(ABS(SW)=1,301,321,8,0),COLOR00FFFF;
STICKLINE(ABS(SW)=0,301,321,8,0),colorgreen;