input:SS(10,1,100,1);//开头加上这句
B1:=MA(C,150);
MID:=MA(CLOSE,40);
TMP2:=STD(CLOSE,40);
TOP:=MID+2*TMP2;
BOTTOM:=MID-2*TMP2;
N1:=BARSLAST(DATE<>REF(DATE,1))+1;
N:HHV(N1,300);
HH:REF(HhV(MA((O+H)/2,15),3*N),1);
LL:REF(LlV(MA((O+L)/2,15),3*N),1);
BSK:(HH/LL)*1000<2040;
QQ1:=CROSS(C,TOP) and BSK and C>B1 and C>HH;
PP1:=CROSS(MID,C)||(C<HHV(H,ENTERBARS+2)-ENTERPRICE*0.012);
QQ2:=CROSS(BOTTOM,C) and BSK and C<B1 and C<LL;
PP2:=CROSS(C,MID) OR (C>LLV(L,ENTERBARS+2)+ENTERPRICE*0.012);
IF HOLDING=0 and QQ1 THEN BUY(1,SS,MARKET);//多空持仓为0并且最高价与前K线HH金叉,做多10手。
IF HOLDING=0 and QQ2 THEN BUYSHORT(1,SS,MARKET);//多空持仓为0并且最低价与前K线LL死叉,做空10手。
IF HOLDING>0 and PP1 THEN SELL(1,HOLDING,MARKET);//多头持仓大于0并且满足M点止损条件,多单全平。
IF HOLDING<0 and PP2 THEN SELLSHORT(1,HOLDING,MARKET);//空头持仓大于0并且满足M点止损条件,空单全平。