[PEL] 复制代码 //收盘k上判断有无未成交单,有的话撤平仓单
abb:=timetot0(CLOSETIME(0))-timetot0(dynainfo(207)),NODRAW;//当前时间(当前的北京时间)距离收盘K时间
if abb<=120 and TGLOBALSUBMITEX(2,'',STKLABEL,0)+TGLOBALSUBMITEX(4,'',STKLABEL,0)>0 then
begin
tcancelex(1,2,'',stklabel);
tcancelex(1,4,'',stklabel);
end
//撤单也需要时间,因此撤单后平仓单独拎出来
if abb<=120 and TGLOBALSUBMITEX(2,'',STKLABEL,0)+TGLOBALSUBMITEX(4,'',STKLABEL,0)=0 then
begin
tsell(tbuyholdingex('','',1)>0 ,0,mkt);
tsellshort(tsellholdingex('','',1)>0,0,mkt);
end
这样调整下再试下。
未成交从全局环境下读取;因为是多秒,直接改成判断离结束还剩多少秒,默认是收盘前2分钟 |