
等级: 新手上路
- 注册:
- 2022-2-4
- 曾用名:
|

楼主 |
发表于 2022-2-5 23:16
|
显示全部楼层
把原来的模型的内容如下:
//交易时间锁定日内
t1:=time>opentime(1) and time<closetime(0)-7000;
t2:=time>=closetime(0)-4500;
//交易条件
开多条件:=c>上轨 and t1 and holding<=0;
开空条件:=c<下轨 and t1 and holding>=0;
//交易系统
开多:buy(开多条件 and cyc>1,ss,market);
开空:buyshort(开空条件 and cyc>1,ss,market);
平多:sell(c<上轨 and holding>0, 0, market);
平空:sellshort(c>下轨 and holding<0,0,market);
收盘平多:sell(t2 and holding>0, 0, thisclose);
收盘平空:sellshort(t2 and holding<0,0,thisclose);
修改成新的如下:
//交易条件
开多条件:=c>上轨 and T0TOTIME(TIMETOT0(CLOSETIME(0))-60*15)>DYNAINFO(207) and holding<=0;//最后开仓时间控制在收盘前15分钟
开空条件:=c<下轨 and T0TOTIME(TIMETOT0(CLOSETIME(0))-60*15)>DYNAINFO(207) and holding>=0;//最后开仓时间控制在收盘前15分钟
//交易系统
开多:buy(开多条件 and cyc>1,ss,market);
开空:buyshort(开空条件 and cyc>1,ss,market);
平多:sell(c<上轨 and holding>0, 0, market);
平空:sellshort(c>下轨 and holding<0,0,market);
// 收盘前清仓
if T0TOTIME(TIMETOT0(CLOSETIME(0))-60*5)<=DYNAINFO(207) or (time=190000 and not(ISLASTBAR)) then begin
sell(1,holding,MARKET);
sellshort(1,holding,MARKET);
end
修改后没有了任何显示,请指教 |
|