N:=5;
TYP := (HIGH + LOW + CLOSE)/3;
cci:(TYP-MA(TYP,N))/(0.015*AVEDEV(TYP,N));
PARTLINE(cci,cci>REF(cci,1),rgb(255,0,0),cci<=REF(cci,1),rgb(0,255,0) );
A1:=cci>REF(cci,1) and REF(cci,1)<REF(cci,2);
C1:=BACKSET(A1>0,2);
D1:=(C1>0 AND REF(C1,1)<1);
A2:=cci<REF(cci,1) and REF(cci,1)>REF(cci,2);
C2:=BACKSET(A2>0,2);
D2:=(C2>0 AND REF(C2,1)<1);
R1:=BACKSET(DISPSTATUS=2,BARSLAST(D1)+1);
S1:=R1>REF(R1,1);
T1:=BACKSET(DISPSTATUS=2,BARSLAST(D2)+1);
U1:=T1>REF(T1,1);
R2:=BACKSET(S1,REF(BARSLAST(D1),1)+2);
S2:=R2>REF(R2,1);
T2:=BACKSET(U1,REF(BARSLAST(D2),1)+2);
U2:=T2>REF(T2,1);
DRAWLINE(S2,cci,S1,cci,1),COLORBLUE,linethick2;
DRAWLINE(U2,cci,U1,cci,1),POINTDOT,COLORBLUE,linethick2;