以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://www.weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://www.weistock.com/bbs/list.asp?boardid=4)
----  收盘前5分钟平仓怎么写?  (http://www.weistock.com/bbs/dispbbs.asp?boardid=4&id=180598)

--  作者:tonyzhu
--  发布时间:2020/6/16 6:48:47
--  收盘前5分钟平仓怎么写?
收盘前5分钟平仓怎么写?
--  作者:FireScript
--  发布时间:2020/6/16 9:23:12
--  

N:=5;
abb:=timetot0(CLOSETIME(0))-time0,NODRAW;//当前K线时间距离收盘K线结束倒计时
abb3:=timetot0(CLOSETIME(0))-timetot0(dynainfo(207)),NODRAW;//当前时间距离收盘K时间    
IF     (abb<N*60 and abb>=0 and (not(ISLASTBAR))) or (ISLASTBAR and  abb3>=0 and abb3<N*60) THEN //兼顾实际交易时候的信号和历史回测信号
begin
sell(holding>0,holding,market);
sellshort(holding<0,holding,market);    
end