以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  如何实现多空信号交替执行  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=76709)

--  作者:打盹的小和尚
--  发布时间:2015/3/20 16:21:14
--  如何实现多空信号交替执行
比如,这一次是开多信号,平仓之后,下一次只能是开空信号,平空之后,再开单又只能是多单,多空信号交替执行,请问如何实现?

--  作者:jinzhe
--  发布时间:2015/3/20 16:27:41
--  

variable:n=0;

 

if 开多条件 and n=0 and holding=0 then begin

    buy......;

    n:=1;

end

 

if 开空条件 and n=0 and holding=0 then begin

    buyshort.....;

    n:=1;

end

 

if 平多条件  then sell.....;

if 平空条件 then sellshort....;

 

if n=1 and type(1)=4 then buy.......;

if n=1 and type(1)=2 then buyshort......;


--  作者:打盹的小和尚
--  发布时间:2015/3/20 16:30:39
--  
 明白了,谢谢!