n:=3;
m:=if(closetime(4)=closetime(0),4,3);
for i=0 to m do
begin
abb:=remainingtime(closetime(i)),nodraw;
if (abb<n and abb>=0) and closetime(i)=time then
begin
DRAWTEXT(1,L,'收盘平仓',COLORRED,0);
收盘平多:sell(1,holding,market);
收盘平空:sellshort(1,holding,market);
break;
end
end