浏览了多个朋友问的关于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编辑过]