以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  请帮忙看看这个模型  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=25430)

--  作者:kongfzchina
--  发布时间:2012/9/12 20:06:33
--  请帮忙看看这个模型

N1=1

longcond:=平空开多条件

shortcond:=平多开空条件;


if holding=0 then begin
 if longcond then
  buy(1,N1,THISCLOSE);
end

if holding=0 then begin
 if shortcond then
  buyshort(1,N1,THISCLOSE);
end

if holding>0 then begin
 if shortcond then begin
  sell(1,holding,THISCLOSE);
  buyshort(1,N1,THISCLOSE);
 end
 

end

if holding<0 then begin
 if longcond then begin
  sellshort(1,holding,THISCLOSE);
  buy(1,N1,THISCLOSE);
 end
 
 
 
请帮忙看看这个下单程序有没有逻辑混乱的地方,为什么模拟时,总是出现多个 委托单,成交后又平掉,剩下一个单。程序中是不是有重复下单的问题,请帮忙指出来谢谢大家

[此贴子已经被作者于2012-9-12 20:07:03编辑过]

--  作者:jinzhe
--  发布时间:2012/9/13 9:00:38
--  

if holding=0 then begin
 if longcond then
  buy(1,N1,THISCLOSE);
end

 

把这样的的都改成

 

if longcond then begin

buy(holding=0,n1,thisclsoe);

end