if marketposition <>0 then begin
if date-entrydate(0)>=exitday then begin
if time>1344 then begin
sell next bar at market; buytocover next bar at market;
end;
end;
end;
if daycounter>=0 and date>date[1] then begin;
daycounter=daycounter+1;
end;
if marketposition<>0 and entrydate=date then begin
daycounter=0;
end;
if marketposition=0 then begin
daycounter=-1;
end;
if marketposition <>0 then begin
if daycounter>=exitday then begin
if time>1344 then begin
sell next bar at market;
buytocover next bar at market;
end;
end;
end;