variable:n=0;
if n=0 and 开仓条件 and holding=0 then begin
开仓语句;
n:=1;
end
if time=closetime(0) then begin
平仓语句;
n:=0;