Is there an order type to exit all positions on bar close? Or do I need to always check current positions at the broker and send the appropriate exit (LX or SX) orders?
The name of the special order GenerateExitOnClose() is confusing as it does not denote that it is order to exit on session close. I think it should be named as GenerateExitOnSessionClose(). I'm looking for a GenerateExitOnBarClose() order or GenerateExit() for immediate exit.
My other question is, on the Orders page in the programmer's guide, the description for exitInfo parameter of SOrderParameters is not very clear. Does the exitInfo indicate contracts to be exited before this order is taken place or is it the exit strategy of the order being created?
Also, from the description:
If the quantity of contracts is specified, then will OrderExit.FromAll and OrderExit.Total be the same?OrderExit:
FromAll – closes all entries, which opened the position. If the quantity of contracts is specified, then close each entry partially on the quantity of contracts specified.
Total – closes the position on ONLY the specified quantity of contracts. The entries will be closed accordingly, starting from the first one, up to the last one, until the exit is executed upon the quantity of contracts specified.
Thanks!