n:=3;e2:=10;e3:15;e4:-15;
MAn:=MA(C,n);MA10:=MA(C,10);MA20:=MA(C,20);MA30:=MA(C,30);MA60:=MA(C,60);
d1:=(MAn-MA10)/MIN(MAn,MA10);
d2:=(MAn-MA20)/MIN(MAn,MA20);
d3:=(MAn-MA30)/MIN(MAn,MA30);
d5:=(MA20-MA10)/MIN(MA20,MA10);
d6:=(MA30-MA10)/MIN(MA30,MA10);
d8:=(MA20-MA30)/MIN(MA20,MA30);
da:=MA(MAX(MAX(MAX(d1,d2),MAX(d3,d5)),MAX(d6,d8))*100,2);
db:=MA(MIN(MIN(MIN(d1,d2),MIN(d3,d5)),MIN(d6,d8))*100,2);
gj:=(2*C+H+L)/4;
顶:=da>10 AND gj>MA30 AND REF(da,1)>MAX(REF(da,2),da);
底:=db<-10 AND gj<MA30 AND REF(db,1)<MIN(REF(db,2),db);
DRAWTEXT(底 AND COUNT(底,BARSLAST(NOT(db<-10 AND gj<MA30)))=1,db*1.1,'底1'),colormagenta;
DRAWTEXT(底 AND COUNT(底,BARSLAST(NOT(db<-10 AND gj<MA30)))=2,db*1.1,'底2'),colormagenta;
DRAWTEXT(底 AND COUNT(底,BARSLAST(NOT(db<-10 AND gj<MA30)))=3,db*1.1,'底3'),colormagenta;
DRAWTEXT(底 AND COUNT(底,BARSLAST(NOT(db<-10 AND gj<MA30)))=4,db*1.1,'底4'),colormagenta;
DRAWTEXT(底 AND COUNT(底,BARSLAST(NOT(db<-10 AND gj<MA30)))=5,db*1.1,'底5'),colormagenta;
DRAWTEXT(底 AND COUNT(底,BARSLAST(NOT(db<-10 AND gj<MA30)))=6,db*1.1,'底6'),colormagenta;
DRAWTEXT(顶 AND COUNT(顶,BARSLAST(NOT(da>10 AND gj>MA30)))=1,da*1.1,'顶1'),colorcyan;
DRAWTEXT(顶 AND COUNT(顶,BARSLAST(NOT(da>10 AND gj>MA30)))=2,da*1.1,'顶2'),colorcyan;
DRAWTEXT(顶 AND COUNT(顶,BARSLAST(NOT(da>10 AND gj>MA30)))=3,da*1.1,'顶3'),colorcyan;
DRAWTEXT(顶 AND COUNT(顶,BARSLAST(NOT(da>10 AND gj>MA30)))=4,da*1.1,'顶4'),colorcyan;
DRAWTEXT(顶 AND COUNT(顶,BARSLAST(NOT(da>10 AND gj>MA30)))=5,da*1.1,'顶5'),colorcyan;
DRAWTEXT(顶 AND COUNT(顶,BARSLAST(NOT(da>10 AND gj>MA30)))=6,da*1.1,'顶6'),colorcyan;
STICKLINE(db<-10 AND gj<MA30,db,-5,1,0),RGB(0,255,0);
STICKLINE(da>10 AND gj>MA30,da,5,1,0),RGB(255,0,0);
STICKLINE(C,5,-5,15,0),RGB(80,80,80);