-- 作者:jinzhe
-- 发布时间:2016/8/3 14:51:14
--
这段代码要同时交易主力和后主力合约
主力合约:=\'AA01\';//这里AA01代表你的主力合约代码;
后主力合约:=\'AA02\';//这里AA02代表你的后主力合约代码;
v1:=callstock(主力合约,vtvol,datatype);
v2:=callstock(后主力合约,vtvol,datatype);
bl:=v1/v2;//bl就是用户所需要的主力和后主力合约成交量的比值
A:=0.5;//A就是用户所讲的标准,这里赋值为0.5
if bl<a and stricmp(stklabel,主力合约) then buy(1,10,market);//当比值小于标准值时买主力合约的
if bl>a and stricmp(stklabel,后主力合约) then buy(1,10,market);//当比值大于标准值时买后主力合约的
|
-- 作者:flyme
-- 发布时间:2016/8/4 12:43:48
--
M3 :=month>=10 and month<=12; M6 :=month>=1 and month<=3; M9 :=month>=4 and month<=6; M12:=month>=7 and month<=9;//时间处于7月-9月期间 取3月 :=callstock(\'t03\',vtOPENINT,datatype); 取6月 :=callstock(\'t06\',vtOPENINT,datatype); 取9月 :=callstock(\'t09\',vtOPENINT,datatype); 取12月:=callstock(\'t12\',vtOPENINT,datatype);//取12月数据 后主力合约:=if(M3,取3月,if(M6,取6月,if(M9,取9月,取12月)));
主力合约:=\'t00\';//这里AA01代表你的主力合约代码; //后主力合约:=\'t12\';//这里AA02代表你的后主力合约代码; v1:=callstock(主力合约,OPENINT,datatype); v2:=callstock(后主力合约,OPENINT,datatype); bl:=v2/v1;//bl就是用户所需要的主力和后主力合约成交量的比值 A :=0.6;//A就是用户所讲的标准,这里赋值为0.5 if bl<a and stricmp(stklabel,主力合约) and holding<=0 then buy(1,10,market);//当比值小于标准值时买主力合约的 if bl>a and stricmp(stklabel,后主力合约)and holding>=0 then buy(1,10,market);//当比值大于标准值时买后主力合约的
以上代码错在哪里?没信号?
|