B1:=CLOSE[1];
B2:=CLOSE[2];
SS:=IF(CLOSE>CLOSE[1] AND CLOSE[1]>=CLOSE[2],1,IF(CLOSE<CLOSE[1] AND CLOSE[1]<=CLOSE[2],-1,IF(CLOSE>CLOSE[2] AND CLOSE[2] >CLOSE[1],2,IF(CLOSE<CLOSE[2] AND CLOSE[2]<CLOSE[1],-2,0))));
SM:=IF(CLOSE[SS]<>0,CLOSE[SS],IF(CLOSE[SS-1]<>0,CLOSE[SS-1],IF(CLOSE[SS-2]<>0,CLOSE[SS-2],IF(CLOSE[SS-3]<>0,CLOSE[SS-3],IF (CLOSE[SS-4]<>0,CLOSE[SS-4],IF(CLOSE[SS-5]<>0,CLOSE[SS-4],0))))));
tow1:=IF(CLOSE>CLOSE[1], CLOSE,CLOSE[1]),POINTDOT,colorwhite;
tow2:=IF((SS=-1 OR SS=-2) AND SM>0, B2,TOW1),POINTDOT,colorwhite;
TOWER:IF(tow1>tow2, tow1,TOW2),POINTDOT,colorgray;
STICKLINE(CLOSE>=REF(C,1),CLOSE,REF(C,1),9,1),colorred;
STICKLINE(CLOSE<REF(C,1),CLOSE,REF(C,1),9,0),colorgreen;
STICKLINE(REF(C,1)>=REF(C,2) AND CLOSE<REF(C,1),REF(C,1),MAX(REF(C,2),CLOSE),9,1),colorred;
STICKLINE(REF(C,1)<REF(C,2) AND CLOSE>=REF(C,1),REF(C,1),MIN(REF(C,2),CLOSE),9,0),colorgreen;