ATM Order Strategy- with 2 Targets

Hi there,

I am working on a Chart Trader code and an ATM Strategy. Basically place a 2 Contracts LMT Order, with a Stop Loss Order and 2 LMT Target Orders. I have been trying using Bracket order and OCAGroup. And so far the only solution I have managed to come up with is this:


(The Code paste button is gone and is not working for me).

There must be some better way, instead of using 2 Stop Loss Orders- or is this the solution?

Jorgen

Hi Team,

Since no reply, I assume that no one has worked with sending TWS an ATM Order Strategy with 2 Targets, so please let me explain how this should work (which I should have explained in my first message- sorry about that!):

Let's take a Long Entry for ES as an example. Enter a LMT Buy Order for 2 Contracts.

Then a Stop Loss Order for 2 Contracts has to be placed, let's say 4 Points, below the Entry Order.

Then for Target 1, a LMT Sell Order for 1 Contract, 5 points above the Entry.

For Target 2, a LMT Sell Order for 1 Contract is placed 10 points above the Entry Price.

That sounds simple- right? But unfortunately not! Because if the Stop Loss Order is hit first, the Target 1 and Target 2 Limit Orders have to be cancelled.

But if the trade goes well, and Target 1 is hit, One Contract will be sold and the Stop Loss Order has to be reduced from 2 Contracts to 1 Contract.

Then if everything continues to go well, when Target 2 is hit, we have a profitable trade and the Stop Loss is cancelled. On the other hand if the Price reverse and the Stop Loss is hit, then the Target 2 LMT Sell order has to be cancelled.

So what I showed in my first message is one solution, with an Entry Order and two OCA Groups. Works fine, but it would be more elegant with only one Stop Loss Order...

Any other way to achieve this, or is my solution the way to do it?

Thanks and Regards,

Jorgen

You can always paste the code just by pressing CTRL+V (plus three back ticks ``` will give you code block)

As to your question TWS bracket orders are "by design" one bracket - i.e. one profit target and one stop loss. So your solution with 2 groups is consistent with what TWS wants to receive.

1 Like

Thank you very much for the confirmation Tomasz! And for the paste code trick!

Regards,

Jorgen