做个标记
variable:bj=0;
variable:yl=0;
开仓条件加入bj=0
if 平多条件 and holding>0 then begin
sell(1,0,marketr);
yl:=yl+numprofit(1);
if yl>=1000 then bj:=1;
end
if 平空条件 and holding<0 then begin
sellshort(1,0,marketr);
yl:=yl+numprofit(1);
if yl>=1000 then bj:=1;
end
if time=closetime(1) then bj:=0;
if time=closetime(0) then bj:=0;
globalvariable:bj=0;
globalvariable:yl=0;
开仓条件加入bj=0
if 平多条件 and tholding>0 then begin
tsell(1,0,mkt);
yl:=yl+numprofit(1);
if yl>=1000 then bj:=1;
end
if 平空条件 and tholding<0 then begin
tsellshort(1,0,mkt);
yl:=yl+numprofit(1);
if yl>=1000 then bj:=1;
end
if time=closetime(1) then bj:=0;
if time=closetime(0) then bj:=0;
这样用要走完k线下单,不然会重复累加的迭代