MTM:=C-REF(C,1);
DX:=100*EMA(EMA(MTM,6),6)/EMA(EMA(ABS(MTM),6),6);
YXF:=IF(LLV(DX,2)=LLV(DX,7) AND COUNT(DX<0,2) AND CROSS(DX,MA(DX,2)),1,0);
加仓:=IF(FILTER(YXF=1,5),20,0);
买:=(ZIG(3,5)>REF(ZIG(3,5),1)) AND (REF(ZIG(3,5),1)<=REF(ZIG(3,5),2)) AND (REF(ZIG
(3,5),2)<=REF(ZIG(3,5),3));
卖:=(ZIG(3,5)<REF(ZIG(3,5),1)) AND (REF(ZIG(3,5),1)>=REF(ZIG(3,5),2)) AND (REF(ZIG
(3,5),2)>=REF(ZIG(3,5),3));
P1:=5;
P2:=4;
VARA:=LLV(LOW,P1);
VARB:=HHV(HIGH,P1);
K:= EMA((CLOSE-VARA)/(VARB-VARA)*100,P2);
D:= EMA(0.667*REF(K,1)+0.333*K,2);
BBIS:=(MA(CLOSE,2)+MA(CLOSE,3)+MA(CLOSE,5))/3;
BBIL:=(MA(CLOSE,8)+MA(CLOSE,13)+MA(CLOSE,21))/3;
IF (BARSLAST(加仓=20)<2 AND BARSLAST(买=1)<3 AND BARSLAST(CROSS(K,D))<2 AND CLOSE>BBIS AND (加仓=20 OR 买=1 OR CROSS(K,D)))
BUY;
IF (BARSLAST(卖=1)<3 AND BARSLAST(CROSS(D,K))<2 AND (卖=1 OR CROSS(D,K)))
SELL;
DDJL=((ZDMR[-1]+BDMR[-1])-(ZDMC[-1]+BDMC[-1]))/SHGZG*100;
//DDJL:=((IF(ISNULL(ZDMR[-1]),0,ZDMR)+IF(ISNULL(BDMR[-1]),0,BDMR))-(IF(ISNULL(ZDMC[-1]),0,ZDMC)+IF(ISNULL(BDMC[-1]),0,BDMC)))/SHGZG*100;
MAD3=MA(DDJL,3);
MAD5=MA(DDJL,5);
MAD8=MA(DDJL,8);
MAD13=MA(DDJL,13);
MADL=(MAD3+MAD5+MAD8)/3;
DRAWTEXT((DDJL>2 AND LOW/REF(CLOSE,1)<0.92),LOW,'注意')
[local]1[/local]