N1:=5;N2:=10;N3:=20;N4:=30;P:=2;
MA1:=EMA(CLOSE,N1);
MA2:=EMA(CLOSE,N2);
MA3:=EMA(CLOSE,N3);
MA4:=EMA(CLOSE,N4);
TJ1:=crOSS(MA1,MA2) AND C>O AND C>REF(C,1) AND C/REF(C,1)>=1.018
OR CROSS(MA1,MA4) AND C>O AND C>REF(C,1) AND C/REF(C,1)>=1.018
OR CROSS(MA2,MA3) AND C>O AND C>REF(C,1) AND C/REF(C,1)>=1.018
OR CROSS(MA1,MA3) AND C>O AND C>REF(C,1) AND C/REF(C,1)>=1.018;
{ _通达信指标公式}
TJ2:=(MAX(MA1,MAX(MA2,MA3))-MIN(MA1,MIN(MA2,MA3)))/
MIN(MA1,MIN(MA2,MA3))*100<=P;
XG:TJ1 AND TJ2;