| 
 等级: 免费版 
注册: 2022-1-1曾用名:  | 
 
| 请教一下,我模拟回测的时候,用的3分钟以上周期, 用在系统里设置了“收盘前1分钟该市场品种强行平仓”和如下代码,今天收盘没有全部成交,请老师帮忙改下,我写代码不是很好,谢谢。代码如下: 
 
 
 if time>=closetime(0) then
 sell(1,holding,limitr,close);
 end
 if time>=closetime(0) then
 sellshort(1,holding,limitr,close);
 end
 
 NN:=1;
 abb:=timetot0(CLOSETIME(0))-time0;//当前K线时间距离收盘K线结束倒计时
 abb3:=timetot0(CLOSETIME(0))-timetot0(dynainfo(207));//当前时间距离收盘K时间
 if (abb<NN*60 and abb>=0 and (not(ISLASTBAR)))  or (ISLASTBAR and  abb3>=0 and abb3<NN*60) then //兼顾实际交易时候的信号和历史回测信号
 begin
 收盘平多1:sell(holding>0,holding,MARKETR);
 收盘平空1:sellshort(holding<0,holding,MARKETR);
 END
 
 
 | 
 |