Page 1 of 1

SETEXITONCLOSE in auto trading

Posted: 27 Aug 2008
by ppan
The SETEXITONCLOSE cannot close all the open positions before the market close in auto trading. How to use the SETEXITONCLOSE in Auto Trading?

Posted: 28 Aug 2008
by khalaad
ppan

SetExitonClose may only be used when testing, not live trading.

I do not thing it is advisable to close an open position when trading live via a general command; such command should be congruent with the rest of the code.

Khalid

Re: SETEXITONCLOSE cannot be used in auto trading

Posted: 28 Aug 2008
by SUPER
The SETEXITONCLOSE cannot close all the open positions before the market close in auto trading. How to use the SETEXITONCLOSE in Auto Trading?
You can use time based condition to exit something like:

Code: Select all

Input: MyTime(1528);

If time >= MyTime then begin

Sell ("_LX_") Next Bar at Market;
BuytoCover("_SX_") Next Bar at Market;

end;
Regards
Super

Posted: 28 Aug 2008
by khalaad
Super,

What you have suggested is correct as far as exits are concerned.

But one will also need to ensure there are NO NEW ENTRIES between the MyTime exit and daily close!

Then there could the matter of IBOG being TRUE or FALSE.

Khalid

Posted: 28 Aug 2008
by ppan
Super,

Your code is correct but I should use 1 min or 5 min bar to run the system. If I use 30 min bar or 15 min bar, the system will exit 30 min or 15 min before the market close. The exit price and the real market close may have a big difference.

Posted: 29 Aug 2008
by SUPER
Super,

Your code is correct but I should use 1 min or 5 min bar to run the system. If I use 30 min bar or 15 min bar, the system will exit 30 min or 15 min before the market close. The exit price and the real market close may have a big difference.
The code reads computer time so it should not matter, however you have to remeber what Khalaad suggested.

There is a very elgant code posted on TS forum by Goose and I use it with great effect. (EoD Exit)

Message me if you do not have access to TS forum.

Regards
Super

Posted: 29 Aug 2008
by ppan
Super,

Where is the code?

Posted: 30 Aug 2008
by SUPER
Super,

Where is the code?
Here's link to the code you are looking for.

https://www.TS.com/Discussion ... xactMatch=

Regards
Super

Posted: 30 Aug 2008
by aljafp
Super,

Where is the code?
Here's link to the code you are looking for.

https://www.TS.com/Discussion ... xactMatch=

Regards
Super
hi,
some of us don't have access to TS forum,
could you kindly paste the code here ?

thanks appreciate it.

Posted: 31 Aug 2008
by SUPER
Super,

Where is the code?
Here's link to the code you are looking for.

https://www.TS.com/Discussion ... xactMatch=

Regards
Super
hi,
some of us don't have access to TS forum,
could you kindly paste the code here ?

thanks appreciate it.
Here's it.

[/code]

Posted: 01 Sep 2008
by ppan
Thanks for your code. Very useful.