以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  请问IF两个选择叠加为何不出信号  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=156651)

--  作者:maxuser2004
--  发布时间:2017/8/9 10:59:24
--  请问IF两个选择叠加为何不出信号
书写如下:
if A then begin
    if B then 
    buy(1,1,market);
    if C  then begin
    sell(1,holding,market);
    buyshort(1,1,market);
    end
 end

其中B和C是两种相反条件,共用A条件,这样不知道为啥B条件下的开多信号无法产生?
但是,可以产生C条件下的开空信号,但是,B条件下的开多信号就没了。。。
请教版主,谢谢!

--  作者:wenarm
--  发布时间:2017/8/9 11:12:18
--  

 应有空头持仓造成的。可以输出holding 确认下

 

if A then begin
    if B then begin
           sellshort(1,holding,market);
           buy(1,1,market);
    end
    if C  then begin
          sell(1,holding,market);
          buyshort(1,1,market);
    end
 end

--  作者:maxuser2004
--  发布时间:2017/8/9 11:21:02
--  还是不行,还是出不来信号
还是不行,还是出不来开多信号
--  作者:pyd
--  发布时间:2017/8/9 11:29:42
--  

if A then begin
    if B then begin
           sellshort(holding<0,holding,market);
           buy(holding=0,1,market);
    end
    if C  then begin
          sell(holding>0,holding,market);
          buyshort(holding=0,1,market);
    end
 end

没有开多信号就是条件不满足,把条件输出看下