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 > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 03-26-2010, 12:42 PM   #1
Tight Face
Member
 
Join Date: Apr 2008
Posts: 72
Thanks: 0
Thanked 0 times in 0 posts
Default Race conditions - order submission

I'm wondering which method I should put my limit orders submissions in to that would avoid race conditions during a quickly moving market. I would have a List<LadderRow> of limit orders on the book and would want to remove/cancel limit orders as the market ticked in any direction. It would seem I'd want to put them in the OnBarUpdate() method. But what would happen if say the bid price moved up a tick and down a tick before my order confirmation could be received? I'd think a cancellation order might be sent before I received a order received packet.

So I wonder if instead I should place my order logic in a custom timer event method like the one listed in the reference samples. That way it would only check every 1000ms to see the status of the market and make any order changes. Thanks for input.
Tight Face is offline  
Reply With Quote
Old 03-26-2010, 01:31 PM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

If you do it off of OnBarUpdate() and had CalculateOnBarClose = false then you would run into issues you suspected in your post. Using a custom event could be one way to go about this. You could also program it to not do anything till modification confirmation has been received.
NinjaTrader_Josh is offline  
Reply With Quote
Old 03-26-2010, 01:45 PM   #3
Tight Face
Member
 
Join Date: Apr 2008
Posts: 72
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks for the confirmation Josh. I'm going to test out utilizing the OnOrderUpdate method. Is this what you were referring to in your last sentence?
Tight Face is offline  
Reply With Quote
Old 03-26-2010, 02:09 PM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Correct. Off of OnOrderUpdate() you can check for the order state to be cancelled.
NinjaTrader_Josh 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
Unmanaged Order Submission NinjaTrader_Ray Version 7 Beta General Questions & Bug Reports 32 11-19-2009 03:08 PM
NT7: New Unmanaged Order Submission BillCh Suggestions And Feedback 1 06-26-2009 08:30 AM
Race Condition Issue and Order Reject dax3k Automated Trading 7 04-06-2009 08:19 AM
stop and target order submission mdm72 Strategy Development 3 02-26-2009 07:08 AM
Race Conditions TAJTrades Strategy Development 11 12-15-2008 07:19 AM


All times are GMT -6. The time now is 09:13 AM.