N:=13;
N1:=5;
TYP:=(HIGH+LOW+CLOSE)/3;
CCI14:(TYP-MA(TYP,N))/(0.015*AVEDEV(TYP,N)),LINETHICK2,COLORLIBLUE;
CCI55:(TYP-MA(TYP,N1))/(0.015*AVEDEV(TYP,N1)),LINETHICK2,COLORMAGENTA;
1:=CCI14;
AA:=REF(RSI1,N)=HHV(RSI1,2*N+1);
BB:=BACKSET(AA,N+1);
CC:=FILTER(BB,N) AND RSI1=HHV(RSI1,N+1);
A1:=BARSLAST(REF(CC,1));
顶背离:=REF(RSI1,A1+1) RSI1 AND CC;
DRAWLINE(CC,RSI1,FILTER(顶背离 0,5),RSI1,0),COLORGREEN,LINETHICK2;
AA2:=REF(RSI1,N)=LLV(RSI1,2*N+1);
BB2:=BACKSET(AA2,N+1);
CC2:=FILTER(BB2,N) AND RSI1=LLV(RSI1,N+1);
A2:=BARSLAST(REF(CC2,1));
底背离:=REF(RSI1,A2+1) RSI1 AND CC2;
DRAWLINE(CC2,RSI1,FILTER(底背离 0,5),RSI1,0),COLORMAGENTA,LINETHICK2;
CCI底背离:=底背离 AND CROSS(CCI14,-100);
X:=CROSS(CCI14,-100);
IF(CCI14 =100,CCI14,DRAWNULL),COLORGREEN,LINETHICK2;
IF(CCI14 =-100,CCI14,DRAWNULL),COLORRED,LINETHICK2;
DRAWTEXT(底背离,-100, 买入 ),COLORRED;
DRAWTEXT(顶背离,100, 卖出 ),COLORGREEN;
正100参考线:100,COLORRED;
正0参考线:0,COLORWHITE;
负100参考线:-100,COLORGREEN;