实盘中由于流动性,该策略并不会赚钱.
推荐楼主还是多完善完善策略思想
B1:=DYNAINFO( 28);//买一价
S1:=DYNAINFO( 34);//卖一价
Vb:=DYNAINFO( 25);//买一挂单量
Vs:=DYNAINFO( 31);//卖一挂单量
Vd:=vol;
Vm:=sum(vol,2);//每秒市场成交量
if Vs<=Vm+Vd then tbuy(1,1,lmt,DYNAINFO(34));
if TISREMAIN(1)=1 and TSUBMIT(1)>1 and Vs<=Vm+Vd and DYNAINFO(34)=TORDERPRICE(1,1)+1 THEN
tbuy(1,1,lmt,DYNAINFO(34));
实现的是你的1),2),3),您先看看是否是您需要的.
版主能不能帮我完整的写完啊,上面只实现一部分啊
金币是次要的,版你就帮帮在期货苦苦挣扎的可怜苍生吧,很多人都要这样的代码
//供参考,用于后台程序化.希望能帮助到您
B1:=DYNAINFO( 28);//买一价
S1:=DYNAINFO( 34);//卖一价
Vb:=DYNAINFO( 25);//买一挂单量
Vs:=DYNAINFO( 31);//卖一挂单量
Vd:=vol;
Vm:=sum(vol,2);//每秒市场成交量????---在分笔周期上此表达该合约秒成交量
if Vs<=Vm+Vd and TISREMAIN(1)=0 then
begin
tbuy(1,1,lmt,DYNAINFO(34));
EXTGBDATASET('flag',1);
end
if EXTGBDATA('flag')=1 and TISREMAIN(1)=1 and TSUBMIT(1)>1 and Vs<=Vm+Vd and DYNAINFO(34)=TORDERPRICE(1,1)+1 THEN
tbuy(1,1,lmt,DYNAINFO(34)),ALLOWREPEAT;
//条件4
if Vs>Vm+Vd and TISREMAIN(1)=0 then
begin
tbuy(1,1,lmt,DYNAINFO(28));
EXTGBDATASET('B1',DYNAINFO(28));//记录买一价
EXTGBDATASET('S1',DYNAINFO(34));//记录卖一价
EXTGBDATASET('flag',2);
end
//条件5
if EXTGBDATA('flag')=2 and TISREMAIN(1)=1 and TSUBMIT(1)>1 and Vb<=Vm+Vd then
begin
TCANCEL(1,1);
tbuy(1,1,lmt,EXTGBDATA('B1')-1);
EXTGBDATASET('flag',3);
end
//条件6
if EXTGBDATA('flag')=3 and TISREMAIN(1)=1 and TSUBMIT(1)>1 and Vb>Vm+Vd then
begin
TCANCEL(1,1);
tbuy(1,1,lmt,EXTGBDATA('B1'));
end
//条件7
if EXTGBDATA('flag')=3 and DYNAINFO( 28)=EXTGBDATA('B1')-1 and Vs<=Vm+Vd then
begin
tbuy(1,1,lmt,EXTGBDATA('S1')-1);
end
//条件8
if EXTGBDATA('flag')=3 and DYNAINFO( 28)=EXTGBDATA('B1')-1 and Vb<=Vm+Vd and TISREMAIN(1)=1 and TSUBMIT(1)>1 then
begin
TCANCEL(1,1);
tbuy(1,1,lmt,EXTGBDATA('B1')-1);
EXTGBDATASET('flag',4);
end
//条件9
IF EXTGBDATA('flag')=4 and DYNAINFO( 28)=TORDERPRICE(1,1) and Vb<=Vm+Vd then
tbuy(1,1,lmt,DYNAINFO( 28)-1),ALLOWREPEAT;