以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  平仓再开仓,不能成交为什么?  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=56900)

--  作者:厚德载物
--  发布时间:2013/9/23 15:26:01
--  平仓再开仓,不能成交为什么?
BC1:=HOLDING>0 AND X>0
BC2:=HOLDING=0 AND X>0
SELL(BC1,HOLDING,THISCLOSE),ORDERQUEUE;
BUYSHORT(BC2,1,MARKET),ORDERQUEUE;
BUYSHORT执行不了,为什么?

--  作者:fly
--  发布时间:2013/9/23 16:42:14
--  

怎么没有平空开多的指令.

给您提供个简单代码,供您参考

 

buycond:=ref(count(c>o,2)=2,1);
sellcond:=ref(count(c<o,2)=2,1);

//平空

if holding<0 and buycond  then sellshort(1,1,market);

 

//开多
if buycond  and holding=0  then
 begin
 buy(1,1,market);
 end
 

//平多
if holding>0 and sellcond  then sell(1,1,market); 

//开空
if holding=0 and sellcond  then buyshort(1,1,market),;


--  作者:厚德载物
--  发布时间:2013/9/23 20:01:55
--  

你回答我的问题了吗?

 

我的代码有什么错误?


--  作者:jinzhe
--  发布时间:2013/9/24 9:05:42
--  

你策略一共就这么点代码?