![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Senior Member
Join Date: Jan 2009
Posts: 216
Thanks: 0
Thanked 1 time in 1 post
|
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. |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 981 times in 963 posts
|
Hi binwang2, please try this with orderHandling set to 'per Strategy Position' under Tools > Options > Strategies > NinjaScript > OrderHandling
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Jan 2009
Posts: 216
Thanks: 0
Thanked 1 time in 1 post
|
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. |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 981 times in 963 posts
|
With 'by strategy position' NinjaTrader will send out one target and one stop order and modify the size as entry executions are reported.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Jan 2009
Posts: 216
Thanks: 0
Thanked 1 time in 1 post
|
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. |
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 981 times in 963 posts
|
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.
Bertrand
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Partial Fills | murfinp | Strategy Development | 2 | 04-16-2009 07:09 AM |
| Partial Fills On Entry During Simulation | kcsystemtrader | Strategy Development | 7 | 01-09-2009 01:30 PM |
| Partial Fills | nfeldberg | Strategy Development | 2 | 08-26-2008 09:23 AM |
| Partial Fills | SystemTrading | Miscellaneous Support | 1 | 08-20-2008 08:43 AM |
| Partial Fills | Harry | ATM Strategies (Discretionary Trading) | 5 | 02-26-2008 06:25 AM |