以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  后台多策略的全局变量  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=31212)

--  作者:leonxu
--  发布时间:2012/12/6 9:46:01
--  后台多策略的全局变量

请问,后台交易多策略时,我是用一个策略不同参数来控制不同周期交易形成多策略,里面的全局变量,是只影响一个策略的,还是多策略之间会共用,因为我用全局变量来控制开平仓必须先交易完成后再顺序下单。程序如下

 

if Z>0 and tenterbars(1)>0 then begin

tsell(sellcond and tbuyholding(1)>0,tbuyholding(1),mkt);
if tholding2=0 then extgbdataset(\'orderdone\',0);
tbuyshort (buyshortcond and extgbdata(\'orderdone\')=0 and tholding2=0,1,mkt);
extgbdataset(\'orderdone\',1);


tsellshort(sellshortcond and tsellholding(1)>0,tsellholding(1),mkt);
if tholding2=0 then extgbdataset(\'orderdone\',0);
tbuy(buycond and extgbdata(\'orderdone\')=0 and tholding2=0,1,mkt);
extgbdataset(\'orderdone\',0);

 

即多个策略里的orderdone是联通共用的,还是只对自己策略的


--  作者:jinzhe
--  发布时间:2012/12/6 9:47:15
--  
全局变量,只要软件内有用到ORDERDONE的都是这个
--  作者:leonxu
--  发布时间:2012/12/6 11:37:43
--  

我是指比如这个程序,我做的策略是A(1,3),后面又做了一个策略A(1,5),这两个策略是一样的程序,只是参数不一样,那里面的orderdone是为各自策略服务,还是共通的,即A(1,3)产生的orderdone值对A(1,5)也产生作用


--  作者:jinzhe
--  发布时间:2012/12/6 13:09:49
--  

这种全局变量是软件内通用的,


--  作者:leonxu
--  发布时间:2012/12/6 13:24:20
--  
即A(1,3)产生的orderdone值对A(1,5)也产生作用?
--  作者:jinzhe
--  发布时间:2012/12/6 13:37:14
--  

这种全局变量不分策略的,是共通的


--  作者:leonxu
--  发布时间:2012/12/6 13:54:53
--  

好的,谢谢