NinjaTrader Support Forum  

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 08-06-2012, 07:16 PM   #1
coolguy8
Junior Member
 
Join Date: Jul 2012
Posts: 3
Thanks: 3
Thanked 0 times in 0 posts
Default OnExecution() for cancelled OCO orders

Hi,

Do cancelled OCO orders (i.e. cancelled because the other pair is filled), get routed through OnExecution(). I am finding that OnExecution() is not called for these cancelled orders, but I wanted to double check with you first.

Just wanted to mention that I am using unmanaged orders.

Thanks.
Last edited by coolguy8; 08-06-2012 at 07:19 PM.
coolguy8 is offline  
Reply With Quote
Old 08-06-2012, 07:26 PM   #2
Radical
Senior Member
 
Join Date: Sep 2008
Posts: 543
Thanks: 80
Thanked 187 times in 131 posts
Default

From http://www.ninjatrader.com/support/h...nexecution.htm :

"The OnExecution() method is called on an incoming execution. An execution is another name for a fill of an order."

So if there's no fill (ie if the order is cancelled), it seems like OnExecution() won't be called.
Radical is offline  
Reply With Quote
The following user says thank you to Radical for this post:
Old 08-06-2012, 07:51 PM   #3
coolguy8
Junior Member
 
Join Date: Jul 2012
Posts: 3
Thanks: 3
Thanked 0 times in 0 posts
Default

Thank you very much for your help.

Do you know if there is any way to get a trigger for cancelled orders? I would like to clean up some internal state variables when this occurs.

Thanks!
coolguy8 is offline  
Reply With Quote
Old 08-06-2012, 07:56 PM   #4
Radical
Senior Member
 
Join Date: Sep 2008
Posts: 543
Thanks: 80
Thanked 187 times in 131 posts
Default

Do it in OnOrderUpdate()

http://www.ninjatrader.com/support/h...rderupdate.htm
Radical is offline  
Reply With Quote
The following 2 users say thank you to Radical for this post:
Old 08-06-2012, 07:57 PM   #5
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,860
Thanks: 163
Thanked 580 times in 571 posts
Default

You can check the order state in OnOrderUpdate()

Code:
protected override void OnOrderUpdate(IOrder order)
{

 if (order.OrderState == OrderState.Cancelled)
         {
              // Do stuff
}
NinjaTrader_Matthew is offline  
Reply With Quote
The following user says thank you to NinjaTrader_Matthew for this post:
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
Unfilled limit orders cancelled fredb987 Strategy Development 3 05-23-2012 08:26 AM
Cancelled Orders BarsArray djkiwi General Programming 7 09-04-2011 05:58 PM
MBTrading, Cancelled Orders, and Me bigfatdrunk Automated Trading 3 03-31-2011 06:41 AM
OCO order automatically cancelled BillyRayValentine Strategy Development 5 01-06-2011 09:32 AM
orders got cancelled light7801 Strategy Development 6 05-04-2010 06:06 AM


All times are GMT -6. The time now is 11:52 PM.