以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [原创]再请教orderqueue和代码写法  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=55459)

--  作者:木鱼石传说
--  发布时间:2013/8/20 22:35:35
--  [原创]再请教orderqueue和代码写法
浏览了多个朋友问的关于orderqueue的用法,有了一点新认识。请教老师,下面四种的开平仓写法,他们执行起来的效果一样吗?有什么区别?请老师指点

第一种写法:平仓、开仓整合在触发条件下,用了orderqueu

//开多
   if longcond then begin
    sellshort(holding < 0 , ss,market),orderqueue;
    buy(holding = 0, ss,market),orderqueue;
    end

//开空
  if shortcond then begin
    sell(holding > 0, ss,market),orderqueue;
    buyshort(holding = 0, ss,market),orderqueue;
    end

第二种写法:平仓、开仓代码分开写,用了orderqueu

//开多
   if longcond then begin
    sellshort(holding < 0 , ss,market),orderqueue;
    end
  if long then begin
    buy(holding = 0, ss,market),orderqueue;
    end

//开空
  if shortcond then begin
    sell(holding > 0, ss,market),orderqueue;
    end
  if short then begin
    buyshort(holding = 0, ss,market),orderqueue;
    end


第三种写法:平仓、开仓整合在触发条件下,不用orderqueu

//开多
   if longcond then begin
    sellshort(holding < 0 , ss,market);
    buy(holding = 0, ss,market);
    end

//开空
  if shortcond then begin
    sell(holding > 0, ss,market);
    buyshort(holding = 0, ss,market);
    end

第四种写法:平仓、开仓代码分开写,不orderqueu

//开多
   if longcond then begin
    sellshort(holding < 0 , ss,market);
    end
  if long then begin
    buy(holding = 0, ss,market);
    end

//开空
  if shortcond then begin
    sell(holding > 0, ss,market);
    end
  if short then begin
    buyshort(holding = 0, ss,market);
    end
[此贴子已经被作者于2013/8/20 22:37:32编辑过]

--  作者:木鱼石传说
--  发布时间:2013/8/20 22:45:34
--  
问的具体一些:

1,第一种写法“平仓、开仓整合在触发条件下,用了orderqueu”与第二种写法“平仓、开仓代码分开写,用了orderqueu"执行机理一样吗?

2,第三种写法“平仓、开仓整合在触发条件下,不用orderqueu”与第四种写法“平仓、开仓代码分开写,不orderqueu"执行机理一样吗?

3,第一种与第三种执行机理有何不同?第二种与第四种执行机理有何不同?

--  作者:jinzhe
--  发布时间:2013/8/21 8:45:02
--  

这个不复杂,加了orderqueue的,就是队列下单模式,需要等前面的单子收到成交回报之后才执行下单动作;不加就不等收到成交回报,触发信号就下单

[此贴子已经被作者于2013/8/21 8:45:09编辑过]

--  作者:木鱼石传说
--  发布时间:2013/8/21 11:16:54
--  
如上还有几个问题,也请老师一并回答
--  作者:admin
--  发布时间:2013/8/21 13:30:32
--  
看orderqueue函数说明,觉得看不懂,或者有迷惑的地方可以提出来,不合理不合适的地方,我们会做修改
[此贴子已经被作者于2013/8/21 13:30:48编辑过]