浏览了多个朋友问的关于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编辑过]
问的具体一些:
1,第一种写法“平仓、开仓整合在触发条件下,用了orderqueu”与第二种写法“平仓、开仓代码分开写,用了orderqueu"执行机理一样吗?
2,第三种写法“平仓、开仓整合在触发条件下,不用orderqueu”与第四种写法“平仓、开仓代码分开写,不用orderqueu"执行机理一样吗?
3,第一种与第三种执行机理有何不同?第二种与第四种执行机理有何不同?
这个不复杂,加了orderqueue的,就是队列下单模式,需要等前面的单子收到成交回报之后才执行下单动作;不加就不等收到成交回报,触发信号就下单
[此贴子已经被作者于2013/8/21 8:45:09编辑过]
看orderqueue函数说明,觉得看不懂,或者有迷惑的地方可以提出来,不合理不合适的地方,我们会做修改
[此贴子已经被作者于2013/8/21 13:30:48编辑过]