以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  为何不开空呢?  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=2930)

--  作者:qkl586
--  发布时间:2010/9/21 1:57:45
--  为何不开空呢?

PK:=SCB OR SCD OR VBD OR SCU;//平空条件
KD:=SCU;//开多条件

PD:=VBK OR XCD OR XCB;//平多条件
KK:=VBK OR XCD;//开空条件

 

PKK:=PK and time>092500 and time<145800;
KDD:=KD and time>092500 and time<145800;


 if PKK then 
 begin
    sellshort(holding<0,0,thisclose);
    buy(KDD AND holding=0,1,thisclose);
 end


 

PDD:=PD AND time>092500 and time<145800;
KKK:=KK AND time>092500 and time<145800;
if PDD then 


 begin
    sell(holding>0,0,thisclose);// mitr,o;
    buyshort(KKK AND holding=0,1,thisclose);// mitr,o;
 end
sell(time>150000 and holding>0,0,thisclose);//定时平仓
sellshort(time>150000 and holding<0,0,thisclose);//定时平仓

问题所在:

PD:=VBK OR XCD OR XCB;//平多条件三个条件全部能执行
KK:=VBK OR XCD;//开空条件只执行VBK,而XCD不能开空,图表上只显示其平多。

请高手指点一下问题出在哪里?公式这样写是否正确?谢谢!


--  作者:fly
--  发布时间:2010/9/21 8:46:36
--  

1.既然VBK在平多开空的时候没有问题,那你不妨把VBK在平多开空的条件中都去掉.

 

集中跟踪输出XCD看看问题出在哪里.

 

2.你的是多条件复杂组合,最好把条件拆的简单点,分别组成策略一个一个跟踪一下.