[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re[2]: Close all trades at end of doy question



PureBytes Links

Trading Reference Links

> I once again forgot to mention the version I use, TS4.
> When I tried using SetExitOnClose on TS4 I got a message "Word not
> recognized by easylanguage."

You can use something like

if Time = Sess1EndTime then begin
  exitlong;
  exitshort;
end;

....which will work OK on days when the market trades until its 
normal closing time.  If the market closes early, the test won't 
work, but that may be a minor issue for your needs.

If you really MUST have it exit at the end of EVERY trading day, 
you have to do something like this:

if Date of next bar > Date then begin
  exitlong;
  exitshort;
end;

....however, accessing the next bar limits the kinds of orders you 
can use in your system.  You'll have to decide which is the best 
solution for you.

Frankly, the best and most reliable way is just to use the 
checkbox.  That way it always works right and doesn't limit your 
system in any way.

Gary