以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [原创]历史测试和实时交易收盘平仓  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=7578)

--  作者:z7c9
--  发布时间:2011/8/17 21:32:30
--  [原创]历史测试和实时交易收盘平仓
if date<refx(date,1) then begin
 sell(1,holding,limitr,close);
 sellshort(1,holding,limitr,close);
end else begin
 if(date=currentdate and time=145500 and currenttime>=145900) begin
  sell(1,holding,limitr,close);
  sellshort(1,holding,limitr,close);
 end 
end

--  作者:readonly
--  发布时间:2012/5/10 7:59:22
--  

好像上半段程序已经可以完成收盘平仓啦,请问下半截程序的用途是什么?

 

end else begin
if(date=currentdate and time=145500 and currenttime>=145900) begin
sell(1,holding,limitr,close);
sellshort(1,holding,limitr,close);
end
end


--  作者:rushtaotao
--  发布时间:2012/5/10 9:01:04
--  

上半段和下半段是条件不一样吧

上半段满足此条件平仓if date<refx(date,1)

下半段满足此条件平仓if(date=currentdate and time=145500 and currenttime>=145900)

时间的限制有区别,一个平历史,一个平当前的