¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

irregularities in STP LMT and LMT orders


R. Saouma
 

Dear Friends


I am faced with the following problem: After submitting an initial (MKT) market order and once the order status is filled, my script automatically submits a STP LMT order and a LMT order. This usually works alright. But seldom the two LMT orders get stuck into the ¡°ApiPending¡± status without moving into the ¡°Submitted¡± status. The end result is that i have naked position with no stops. I tried to check the log file for errors, but unfortunately i don¡¯t see any trace of the LMT orders i submitted.
Has anyone faced similar problem?

I am using JAVA api on netbeans on a MAC. The function i use to submit orders is submitOrder.

public ?void submitOrder (int OrderID, int Side, String OrderType, double LMTprice, double STPprice)

Thanks for your help

Regards
Ramzi?


Nick
 

¿ªÔÆÌåÓý

You can submit a bracket order so that you will either have no position or a position with your exits. However, there is no such function as 'submitOrder' in IB's API so I assume you are using something else.

You need to be able to specify the parent order id and transmit flag in order to submit a bracket order, which does not appear to be an option in your example.

On 11/18/2015 8:34 AM, 'R. Saouma' ramzi.saouma@... [TWSAPI] wrote:

?

Dear Friends



I am faced with the following problem: After submitting an initial (MKT) market order and once the order status is filled, my script automatically submits a STP LMT order and a LMT order. This usually works alright. But seldom the two LMT orders get stuck into the ¡°ApiPending¡± status without moving into the ¡°Submitted¡± status. The end result is that i have naked position with no stops. I tried to check the log file for errors, but unfortunately i don¡¯t see any trace of the LMT orders i submitted.
Has anyone faced similar problem?

I am using JAVA api on netbeans on a MAC. The function i use to submit orders is submitOrder.

public ?void submitOrder (int OrderID, int Side, String OrderType, double LMTprice, double STPprice)

Thanks for your help

Regards
Ramzi?


 

Ramzi, this is slightly off-topic, but I do the same thing manually, except that I submit a STP LMT order with an attached triggered ("Adjusted") TRAILING STP order set to trigger at the profit I hope to capture.

That way the two orders are actually a single order; they're tidier.

--Joe