Login Page - Create Account

Support Board


Date/Time: Sun, 19 May 2024 18:37:08 +0000



Post From: Spreadsheet Trading- Open/Close order type (and CancelAllWorkingOrdersOnExit)

[2016-05-23 20:15:33]
phaedonk - Posts: 352
Having some issues/questions with orders generated from a spreadsheet system.

1. At Time1 both Buy and Sell entries become True.
2. Stop orders (with attached stops) are sent for both entries (stop price away from current price).
3. At Time2 the Buy order is filled (and its attached child is now working) and the Sell order (and its child) is cancelled via J78. J78 then becomes 0. So, we now have a long position and a sell stop-loss order (pic 1)
4. After a minute, Sell entry becomes True and a Sell stop order (with an attached buy stop) is sent (this too away from current price)
5. The Orders window, instead of showing the newly generated orders as an Open type (for the Parent) and a Close type (for the child), is showing the opposite. (pic 2)

A)Why is this happening? It obviously has to do with the current position being long. However, I have disabled the "Support scale-out" and every order is sent as an independent new one, with its own attached orders. Also, a Close order already exists for the current position. Also, how is it possible that a child order is an Open order and its Parent is a Close order? That just makes no sense.

6. At Time3 the Buy Exit column becomes True and should send a Market order to exit the position. Instead I get this message: "BuyExit signal is ignored. Long position quantity does not exist or there are already working exit orders that will flatten the position. Current Position with working exit orders: -1. Current Position: 1. Current Position with exit market orders: 1 | 2016-05-22 23:02:06"

B) Why is this happening? Also, what does it matter if there exist orders that can flatten the position? The Sell Exit is a market sell, not a stop order as the other working orders.

UPDATE: After reading up on this, I see that 6 is related to CancelAllWorkingOrdersOnExit. However, after setting this to Yes, the problem is that instead of only canceling orders related to the long position, it also cancels the Sell Entry order (and its child) that I want to be live. This may be related to 5, with the Sell parent order being treated as a Close order. I do not know, as I have no way of trying it.

The bottom line is that (if my understanding of how this variable works is correct) it makes no sense for CancelAllWorkingOrdersOnExit to cancel ALL orders. It should only cancel all orders related to the Exit that it is dealing with. And it should leave opposite side Opening working orders unaffected. So if you are long, it should cancel all Sell orders that are related to that position, i.e. attached Targets and Stops. And it should not cancel Sell orders that are working (further down the price) to enter a new position.
imagepic1.png / V - Attached On 2016-05-23 20:08:03 UTC - Size: 23.35 KB - 350 views
imagepic2.png / V - Attached On 2016-05-23 20:08:31 UTC - Size: 28.32 KB - 346 views