VARD:=(HIGH+LOW+OPEN+CLOSE)/4;
ma(VARD,5),color0099FF,linethick2;ma(VARD,10),colorCC3333;
ma(VARD,20),colorCC6633;ma(VARD,30),colorCC9933;ma(VARD,40),colorCCCC33;
ma(VARD,50),color99CC66;ma(VARD,60),color66CC66;ma(VARD,70),color33CC66;
ma(VARD,80),color00CC66;ma(VARD,90),color00FF66;ma(VARD,100),color33FF66;
ma(VARD,110),color66FF66;ma(VARD,120),color99FF66;ma(VARD,130),colorCCFF66;
ma(VARD,140),colorFFFF66;ma(VARD,150),color00FFFF;ma(VARD,160),color33FFFF;
ma(VARD,170),color66FFFF;ma(VARD,180),color99FFFF;ma(VARD,190),colorCCFFFF;
ma(VARD,200),colorFFFFFF;ma(VARD,210),colorFFCCFF;ma(VARD,220),colorFF99FF;
ma(VARD,230),colorFF66FF;ma(VARD,240),colorFF33FF;ma(VARD,250),colorFF00FF;
ma(VARD,260),colorCC00FF;ma(VARD,270),color9900FF;ma(VARD,280),color6600FF;
ma(VARD,290),color3300FF;ma(VARD,300),colorred;
B0:=REF(C-O,2);B1:=REF(C,1);B2:=REF(C,2);B3:=REF(C,3);B4:=REF(C,4);
CMAX:=MAX(MAX(MAX(C,B1),B2),B3);CMIN:=MIN(MIN(MIN(C,B1),B2),B3);
STICKLINE(C=CMAX AND (B1>=B2 OR B1>=B3) OR B1=CMAX AND (B2=CMIN OR B3=CMIN) AND C>=B2 OR
B2=CMAX AND B3=CMIN AND C>=B1 OR B3=CMAX AND C>=B1 AND C>=B2,B1,C,5,1),COLORRED;
STICKLINE(C=CMAX AND B1=CMIN,B2,C,5,1),COLORRED;
STICKLINE(C=CMIN AND (B1<B2 OR B1<B3) OR B1=CMIN AND (B2=CMAX OR B3=CMAX) AND C<B2 OR
B2=CMIN AND B3=CMAX AND C<B1 OR B3=CMIN AND C<B1 AND C<B2,B1,C,5,0),COLORWHITE;
STICKLINE(B1=CMAX AND C=CMIN,B2,C,5,0),COLORWHITE;
STICKLINE(b1=cmin and C>=B2 or (b2=cmin and b1<=b3 or
b3=cmin and b1<=b2) and b2<b4 and c>=b1,B1,B2,5,0),COLORWHITE;
STICKLINE(b1=cmax and C<B2 or (b2=cmax and b1>b3 or b3=cmax and b1>b2) and b2>=b4 and c<b1,B1,B2,5,1),COLORRED;