//中间变量
HH1:=stkindi('','xx.A1',0,6);//前8日波幅定义为HH1
LL1:=stkindi('','xx.A2',0,6);//今天开盘价定义为LL1
Z:=stkindi('','xx.A3',0,6);//日线MA30
HH2:=stkindi('','xx.HH',0,6);//前3日最高价定义为HH2
LL2:=stkindi('','xx.LL',0,6);//前3日最低价定义为LL2
//其他变量
Z1:=LL1+0.1*HH1;
Z2:=LL1-0.1*HH1;
手数:=1;
//交易条件
开多条件:=C>HH2 and C>Z and C>Z1;
开空条件:=C<LL2 and C<Z and C<Z2;
//交易系统
BUY(开多条件 AND HOLDING=0,手数 AND MARKET);//多头没有仓位时市价开仓1手
buyshort(开空条件 AND HOLDING=0,手数 AND MARKET);//空头没有仓位时市价开仓1手
//平仓条件
if h<0.99*ENTERPRICE and enterbars>0 and holding>0 then sell(1,holding,market);
if l>1.01*enterbars and enterbars>0 and holding<0 then sellshort(1,holding,market);
if WEEKDAY=1 and time>=145000 then begin
sell(holding>0,holding,market);
sellshort(holding<0,holding,market);
end
//资金管理
当前持仓:HOLDING,COLORGRAY,LINETHICK0;
当前资产:ASSET,NOAXIS,COLORGRAY;