这个要全局变量来控制
比如
variable:duo=0,n=0;
if 开多条件 and duo=0 and holding=0 then begin
buy(1,1,market);
duo:=1;
end
if 开空条件 and kong=0 and holding=0 then begin
buyshort(1,1,market);
kong:=1;
end
if time=closetime(1) then begin
duo:=0;
kong:=0;
end
if time=closetime(0) then begin
duo:=0;
kong:=0;
end
variable:duo=0,kong=0;
if 开多条件 and duo=0 and holding=0 then begin
buy(1,1,market);
duo:=1;
end
if 开空条件 and kong=0 and holding=0 then begin
buyshort(1,1,market);
kong:=1;
end
if time=closetime(1) then begin
duo:=0;
kong:=0;
end
if time=closetime(0) then begin
duo:=0;
kong:=0;
end