N1:=1.8;
N2:=1.8;
X_1:=maX(MAX(HIGH-LOW,Abs(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR:MA(X_1,5),NODRAW;
X_2:=CLOSE/REF(CLOSE,1)<=0.929 AND REF(CLOSE,1)>=REF(MA(CLOSE,22),1);
X_3:=CLOSE/HIGH<=0.911 AND vol>=REF(HHV(VOL,21),1)*1.5 AND REF(CLOSE,1)>=REF(MA(CLOSE,22),1);
X_4:=CLOSE>=HHV(CLOSE,22) AND CLOSE>=MA(CLOSE,63);
X_5:=BArslAst(X_4>=1);
X_6:=COUNT(CLOSE/MA(CLOSE,63)>=1.4,22);
X_7:=IF(X_6>=1,2/3,1);
X_8:=CLOSE=1 OR X_3>=1;
X_9:=BARSLAST(X_8>=1);
BUY1:X_4>=1 AND X_9<=REF(X_5,1);
SELL1:-(X_8>=1 AND X_5<=REF(X_9,1));
B:MAX(HHV(CLOSE,21),MA(CLOSE,63)),NODRAW;
S:MAX(CLOSE*0.929,HHV(CLOSE,BARSLAST(BUY1>=1)+1)-ATR*N1*X_7),NODRAW;
X_10:=BARSLAST(BUY1>=1);
X_11:=BARSLAST(SELL1<=(-1));
主动止盈价:IF(X_10<=X_11 OR COUNT(SELL1<=(-1),0)<=0,REF(CLOSE,X_10)+N2*ATR,0),NODRAW;
主动止盈点:IF(X_10<=X_11 OR COUNT(SELL1<=(-1),0)<=0 AND HIGH>=REF(主动止盈价,1) AND COUNT(HIGH>=REF(主动止盈价,1),X_10)<=1 AND X_10>0,0.5,0);