以文本方式查看主题

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

--  作者:lliang1022
--  发布时间:2014/10/21 9:50:58
--  多条件开单识别问题

例如我想A条件开多单

B条件也是开多单

 

A条件开了,B条件就不开,反之亦然

 

 

如果A条件开的多单用C条件平仓,

 

B条件开的多但用D条件平仓。

 

请问如何实现?

 

谢谢


--  作者:jinzhe
--  发布时间:2014/10/21 9:53:18
--  

variable:n=0,m=0;

if a and holding=0 and n=0 then begin

    buy.........;

    n:=1;

end

 

if c and holding>0 and n=1 then begin

     buy.........;

     n:=0;

end

 

if b and holding=0 and m=0 then begin

    buy.........;

    m:=1;

end

 

if d and holding>0 and m=1 then begin

     buy.........;

     m:=0;

end


--  作者:jinzhe
--  发布时间:2014/10/21 9:57:49
--  

variable:n=0,m=0;

if a and holding=0 and n=0 then begin

    buy.........;

    n:=1;

end

 

if c and holding>0 and n=1 then begin

     sell.........;

     n:=0;

end

 

if b and holding=0 and m=0 then begin

    buy.........;

    m:=1;

end

 

if d and holding>0 and m=1 then begin

     sell.........;

     m:=0;

end

 

 

有地方没写好,改了一下,这下OK了