Globalvariable:n=1;
spk:=cross(hgd,lgd);
手数:=ss;
if THOLDING2=0 and TIME=90000 and (time<=144000) then begin
tbuy(spk,手数,MKT,0),SLITHERMETHOD;
extgbdataset('kaiduo',tenterprice);
tbuyshort(spk,手数,MKT,0),SLITHERMETHOD;
extgbdataset('kaikong',tenterprice);
end
et1:=extgbdata('kaiduo') ;//多头开仓价
et2:=extgbdata('kaikong') ;//空头开仓价
if DYNAINFO(7)>et2 and TSELLHOLDING(1)>0 then begin
if mod(o-(et2+1),2)=0 then tsellshort(1,10,lmt,et2+n,0),SLITHERMETHOD;
n:=1;
if mod(o-(et2+3),2)>=0 then tsellshort(1,10,lmt,et2+2*n-1,0),SLITHERMETHOD;
n:=n+1;
end
if DYNAINFO(7)>et1 and TBUYHOLDING(1)>0 then begin
if mod(o-(et1+2),2)=0 then tsell(1,10,lmt,et1+n,0),SLITHERMETHOD;
if mod(o-(et1+4),2)>=0 then tsell(1,10,lmt,et1+2*n,0),SLITHERMETHOD;
n:=n+1;
end
if DYNAINFO(7)<et1 and TBUYHOLDING(1)>0 then begin
if mod((et1-1)-o,2)=0 then tsell(1,10,lmt,et1-n,0),SLITHERMETHOD;
n:=1;
if mod((et1-3)-o,2)>=0 then tsell(1,10,lmt,et1-2*n+-1,0),SLITHERMETHOD;
n:=n+1;
end
if DYNAINFO(7)<et2 and TSELLHOLDING(1)>0 then begin
if mod((et2-2)-o,2)=0 then tsellshort(1,10,lmt,et2-n,0),SLITHERMETHOD;
if mod((et2-4)-o,2)>=0 then tsellshort(1,10,lmt,et2-2*n,0),SLITHERMETHOD;
n:=n+1;
end
tm:=50;//撤单时间秒
if tisremain(0)>0 and tsubmit(0)>tm then begin
tcancel(1,0);
end
IF TEXITPRICE-C>=1.8 THEN BEGIN
多损:tsell(1,10,mkt);
end
IF C-TEXITPRICE>=1.8 THEN BEGIN
空损:tsellshort(1,10,mkt);
end
请版主帮忙看看,这样编写逻辑、正确?
有问题帮忙修改一下。
编译没问题的话,要在实际运行中,才能发现问题,用户你先用一下