MA5:MA(C,5),NODRAW;
MA10:MA(C,10),NODRAW;
MA20:MA(C,20),NODRAW;
DD:MA5>MA10&&MA10>MA20;
KK:MA5<MA10&&MA10<MA20;
SS:C>HV(MAX(C,O),3);
SS1:C<LV(MIN(C,O),3);
DHC:COUNT(SS1,SUMBARS(SS,1))=1&&SS1;
BF1:BACKSET(DHC,SUMBARS(SS,1));
DRAWTEXT(CROSS(BF1,0.5),H,"波峰");
DRAWICON(REF(DHC,1)&&C>REF(C,1)&&DD,L,4),VALIGN0;
T6C:=VALUEWHEN(REF(DHC,1)&&C>REF(C,1)&&DD,C);
ZS1:=L<T6C*(1-0.005);
ZS2:=COUNT(ZS1,SUMBARS(REF(DHC,1)&&C>REF(C,1)&&DD,1))=1&&ZS1&&SUMBARS(REF(DHC,1)&&C>REF(C,1)&&DD,1)>1;
DRAWTEXT(ZS2,H,"止损"),COLORRED;
BFC:=VALUEWHEN(CROSS(BF1,0.5),H);
ZY1:=CBFC;
ZY2:=COUNT(ZY1,SUMBARS(REF(DHC,1)&&C>REF(C,1)&&DD,1))=1&&ZY1&&EXIST(REF(DHC,1)&&C>REF(C,1)&&DD,SUMBARS(CROSS(BF1,0.5),1));
DRAWTEXT(ZY2,H,"止赢"),COLORRED;
KHC:COUNT(SS,SUMBARS(SS1,1))=1&&SS;
BG1:BACKSET(KHC,SUMBARS(SS1,1));
DRAWTEXT(CROSS(BG1,0.5),L,"波谷"),VALIGN0;
DRAWICON(REF(KHC,1)&&C<REF(C,1)&&KK,H,5);
XT6C:=VALUEWHEN(REF(KHC,1)&&C<REF(C,1)&&KK,C);
XZS1:=H>XT6C*(1+0.005);
XZS2:=COUNT(XZS1,SUMBARS(REF(KHC,1)&&C<REF(C,1)&&KK,1))=1&&XZS1&&SUMBARS(REF(KHC,1)&&C1;
DRAWTEXT(XZS2,L,"止损"),COLORGREEN;
XBFC:=VALUEWHEN(CROSS(BG1,0.5),L);
XZY1:=C>REF(C,1)*(1+0.005) && L<XBFC;
XZY2:=COUNT(XZY1,SUMBARS(REF(KHC,1)&&C<REF(C,1)&&KK,1))=1&&XZY1&&EXIST(REF(KHC,1)&&C<REF(C,1)&&KK,SUMBARS(CROSS(BG1,0.5),1));
DRAWTEXT(XZY2,L,"止赢"),COLORGREEN;