以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  如果有仓位,直接反手,怎么写代码  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=66168)

--  作者:读者
--  发布时间:2014/6/15 20:05:58
--  如果有仓位,直接反手,怎么写代码
如果手中有仓位,需要收盘反手操作,怎么写代码
--  作者:jinzhe
--  发布时间:2014/6/16 9:10:50
--  

if time=closetime(0) and holding>0 then begin

   sell(1,0,market);

   buyshort(holding=0,1,market);

end

 

if time=closetime(0) and holding<) then begin

   sellshort(1,0,market);

   buy(holding=0,1,market);

end