P1:=5;
P2:=20;
P3:=30;
N:=3;
MA5:=MA(C,5),COLORWHITE;
MA1:=MA(C,P1),COLORFF00FF;
MA2:=MA(C,P2),COLOR00FF00;
MA3:=MA(C,P3),COLORYELLOW;
ZH12:=Abs(MA1-MA2)/MA2*100<=N;
ZH13:=ABS(MA1-MA3)/MA3*100<=N;
QSXS1:=MA1>=REF(MA1,1);
QSXS2:=MA2>=REF(MA2,1);
QSXS3:=MA3>=REF(MA3,1);
GJHS:=C>MA1 AND QSXS1 AND NOT(REF(QSXS1,1));
买1:GJHS AND ZH12 AND QSXS2,COLOR00FF00,linethick2;
买2:(GJHS AND ZH13 AND QSXS3)*2,COLORYELLOW,linethick2;
优选:(买1 AND COUNT((MA1>MA2),5)=5) OR (买2 AND COUNT((MA1>MA3),5)=5),COLORWHITE,POINTDOT;
DRAWICON(优选>0,0.3,1);