variable:lossnum=0;// 全局变量,平仓时判断一下是盈利/亏损,若亏损lossnum就加1
ma_hhv:ma(h,30);
ma_llv:ma(l,30);
if CROSS(close,MA_HHV) then BEGIN
SELLSHORT(holding<0,1,MARKET);
if c>enterprice then lossnum:=lossnum+1;
buy(holding=0 and time<185500,lossnum,LIMIT,open);
end
if CROSS(MA_llv,close) then BEGIN
SELL(holding<0,1,MARKET);
if c<enterprice then lossnum:=lossnum+1;
buyshort(holding=0 and time<185500,lossnum,LIMIT,open);
end
if (ASSET-VALUEWHEN(time=190000,ASSET))/VALUEWHEN(time=190000,ASSET)>=0.02 or time=185500 then begin
sell(1,HOLDING,MARKET);
sellshort(1,HOLDING,MARKET);
lossnum:=1;
end