PDA

View Full Version : Canceled trades due to partial entry fills


binwang2
05-14-2009, 08:16 AM
Hi NT experts,


I have an issue with canceled FOREX trades with IB due to partially filled entry orders. It happens very often.


IB automatically routes FOREX orders to its “Exchange” IDEALPRO. When an order size is smaller than certain size, it will also re-route it to IDEAL, of course without trader intervention.


The problem arises with matching stop and target orders when entry order is partially filled. Some partially filled orders will have position size smaller than IB specified size for IDEALPRO. The following stop and target orders will be rejected when using execution.Order.Filled as the quantity in OnExEcution().


After detecting rejected stop and target orders, the NinjaTrader will close the whole position. At the same time, IB is trying to re-route these IDEALPRO-rejected orders to IDEAL.


I am thinking to get the cumulative filled quantities in pre-determined time instead of submit stop and target orders immediately for each execution. Not sure if this is the solution.


Any suggestions are welcome.

NinjaTrader_Bertrand
05-14-2009, 08:25 AM
Hi binwang2, please try this with orderHandling set to 'per Strategy Position' under Tools > Options > Strategies > NinjaScript > OrderHandling

binwang2
05-14-2009, 09:05 AM
I have read similar threads on this subject using "By strategy position".

My impression is that "By strategy position" will still send out stop&target orders based for each partil filled quantity first. When the specified entry amount is fully executed, then the strategy will cancel previous orders and submit another order with quantity equal to all partial fills.

Then NinjaTrader will still see rejected orders first from IB IDEALPRO before it send out replacment order with whole quantity. In this way, the trade will still be closed shortly after it is entered.

let me know if this understanding is correct.

NinjaTrader_Bertrand
05-14-2009, 09:23 AM
With 'by strategy position' NinjaTrader will send out one target and one stop order and modify the size as entry executions are reported.

binwang2
05-14-2009, 09:45 AM
Thanks for the clarification.

So when an order has a partil fill first, 'by strategy position' will send out one stop and one target based on the inital partially filled quantity. Then replace this order when more fills come in.

So when an inital partial fill quantity is less than IB's spec, the subsequent one stop/one target orders will be rejected. Then NinJaTrader will automatically close the whole position when seeing a rejected order, before it modifies the size to reflect the cumulative execution quantity.

Then the issue with IB's IDEALPRO will be still there? Any comments are welcome.

NinjaTrader_Bertrand
05-14-2009, 11:48 AM
I think you're correct binwang2 - I believe you can work around this by reissueing the rejected order to an instrument set up on the IDEAL FX exchange without the size limitation, I will clarify this and get back to you.

NinjaTrader_Bertrand
05-14-2009, 01:11 PM
My idea would work binwang2, but we feel it's making things overcomplicated and you should work then with the normal IDEAL pair to circumvent this issue.