--
//交易条件
开多条件:= ma(c,a)>ma(c,b);//开多平空条件
开空条件:=ma(c,b)>ma(c,a);//开多平空条件
平多条件:=cross(ma(c,b),ma(c,a));
平空条件:=cross(ma(c,a),ma(c,b));
//交易系统
if NUMPROFIT(1 )<0 then BEGIN
手数:=ss;
end
if NUMPROFIT(1)<0 and NUMPROFIT(2 )<0 then BEGIN;
手数:=ss;
end
if NUMPROFIT(1)<0 and NUMPROFIT(2 )<0 and NUMPROFIT(3 )<0 then BEGIN
手数:=ss;
end
if NUMPROFIT(1 )>0 then BEGIN
手数:=1;
end
if ma(c,a)>ma(c,b) then BEGIN
开多:BUY(开多条件 and holding=0,手数,MARKET);
end
平多:SELL(平多条件 and HOLDING>0,手数,MARKET);
{IF ENTERPRICE-C>20*MINDIFF THEN BEGIN
多损:SELL(1,0,MARKET),ORDERQUEUE;
END}
if NUMPROFIT(1 )<0 then BEGIN
手数:=ss;
end
if NUMPROFIT(1)<0 and NUMPROFIT(2 )<0 then BEGIN;
手数:=ss;
end
if NUMPROFIT(1)<0 and NUMPROFIT(2 )<0 and NUMPROFIT(3 )<0 then BEGIN
手数:=ss;
end
if NUMPROFIT(1 )>0 then BEGIN
手数:=1;
end
if ma(c,b)>ma(c,a) then BEGIN
开空:BUYSHORT(开空条件 and HOLDING=0,手数,MARKET);
end
平空:SELLSHORT(平空条件 and HOLDING<0,手数,MARKET);
{IF c-ENTERPRICE>20*MINDIFF THEN BEGIN
空损:SELLshort(1,0,MARKET),ORDERQUEUE;
END}