MID :=MA(CLOSE,20),colorwhite;
UPPER:=MID + 2*STDDEV(CLOSE,20),coloryellow;
LOWER:=MID - 2*STDDEV(CLOSE,20),colorff00ff;
ma5:ma(c,5);
aa:=(mid -LOWER)<c*0.05;
bb:=count(aa,6)>=5;
aa1:=(UPPER-mid )<c*0.05;
bb1:=count(aa1,6)>=5;
xg1:bb1>0 and cross(c,UPPER) or bb>0 and cross(c,mid) and ma5>ref(ma5,1);
DRAWTEXT(bb1>0 and cross(c,UPPER) or bb>0 and cross(c,mid) and ma5>ref(ma5,1),(l * 0.98),'买'),linethick3,colorRed;
DRAWTEXT(bb1>0 and cross(c,UPPER) or bb>0 and cross(c,mid) and ma5>ref(ma5,1),(l * 0.96),'●'),linethick3,colorRed;
