NinjaTrader Support Forum  
X

Attention!

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


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 05-14-2009, 08:16 AM   #1
binwang2
Senior Member
 
Join Date: Jan 2009
Posts: 216
Thanks: 0
Thanked 1 time in 1 post
Default Canceled trades due to partial entry fills

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.
binwang2 is offline  
Reply With Quote
Old 05-14-2009, 08:25 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 981 times in 963 posts
Default

Hi binwang2, please try this with orderHandling set to 'per Strategy Position' under Tools > Options > Strategies > NinjaScript > OrderHandling
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 05-14-2009, 09:05 AM   #3
binwang2
Senior Member
 
Join Date: Jan 2009
Posts: 216
Thanks: 0
Thanked 1 time in 1 post
Default

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.
binwang2 is offline  
Reply With Quote
Old 05-14-2009, 09:23 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 981 times in 963 posts
Default

With 'by strategy position' NinjaTrader will send out one target and one stop order and modify the size as entry executions are reported.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 05-14-2009, 09:45 AM   #5
binwang2
Senior Member
 
Join Date: Jan 2009
Posts: 216
Thanks: 0
Thanked 1 time in 1 post
Default

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.
binwang2 is offline  
Reply With Quote
Old 05-14-2009, 11:48 AM   #6
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 981 times in 963 posts
Default

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 is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -6. The time now is 11:14 AM.