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 > Application Technical Support > Automated Trading

Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader.

Reply
 
Thread Tools Display Modes
Old 02-09-2009, 01:15 PM   #1
worow@yahoo.com
Junior Member
 
Join Date: Jan 2009
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
Default Waiting for execution

Hello,

It is my understanding that duplicate orders (unfilled, same underlying, same quantity, same direction) will be cancelled. Does anyone know a way to either override this or make a strategy pause before sending another order with the same attributes?

Thanks
worow@yahoo.com is offline  
Reply With Quote
Old 02-09-2009, 01:47 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

worow@yahoo.com,

You can use your own flags to limit resending.

Code:
if (some condition && flag)
{
     EnterLongLimit(...);
     flag = false;
}

if (position changes or execution received)
     flag = true;
If you do not want your order to be cancelled because you did not keep it alive on every bar you can try the signature with the liveUntilCancelled bool. Set that to true and it will remain live until it is filled or until you cancel it.
NinjaTrader_Josh is offline  
Reply With Quote
Old 02-09-2009, 01:55 PM   #3
worow@yahoo.com
Junior Member
 
Join Date: Jan 2009
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks Josh,

Would the live until cancel bool work in this situation?

Suppose you're looking at stocks A, B and C.

A event happens that triggers a buy A, sell B order.

Before the fills for A and B return an event happens that triggers a buy C and sell B set of orders.

I'm still not sure if the first sell B order gets canceled or the second and will the liveuntilcancel bool prevent either from being canceled?
worow@yahoo.com is offline  
Reply With Quote
Old 02-09-2009, 02:05 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

Not sure what you mean. Just because you call ExitLong() again does not cancel the order. If anything it will either a) keep it alive or b) modify it to the new parameters you are calling the exit with.
NinjaTrader_Josh is offline  
Reply With Quote
Old 02-09-2009, 03:16 PM   #5
worow@yahoo.com
Junior Member
 
Join Date: Jan 2009
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
Default

Hi Josh,

This is the kind of situation I am trying to avoid:

In my output window I recieve the following trace message:

Ignored PlaceOrder() method... Reason = "There is already a matching order with the same prices and quantity"

I actually want both orders even though the first isn't filled yet. Would liveuntilcancel achieve that?
worow@yahoo.com is offline  
Reply With Quote
Old 02-09-2009, 03:32 PM   #6
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 want both orders use different signal names and also ensure you have EntriesPerDirection set higher. You can also just try submitting at double the quantity to modify the first. That will lower your commissions.
NinjaTrader_Josh is offline  
Reply With Quote
Old 02-09-2009, 03:43 PM   #7
worow@yahoo.com
Junior Member
 
Join Date: Jan 2009
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
Default

I'm not sure how I would use different signal names. From the A, B C example above an order can be generated to sell B is B's bid changed or if A or C's offer changed. I wouldn't want to miss any of those events. I could split all the cases into different strategies but I need to keep track of the aggregate short position in the stocks and I don't know how to share variables safely across strategies. Any suggestions?
worow@yahoo.com is offline  
Reply With Quote
Old 02-09-2009, 03:45 PM   #8
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

Post an example of your code.

Signal names are definable every time you call Enter() or Exit().
NinjaTrader_Josh is offline  
Reply With Quote
Old 02-09-2009, 03:54 PM   #9
worow@yahoo.com
Junior Member
 
Join Date: Jan 2009
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
Default

Gotcha, thanks that will solve the issue.
worow@yahoo.com 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
Phantom execution MelbourneRich Miscellaneous Support 1 08-13-2008 07:10 AM
Order execution funky_boy Strategy Development 11 07-18-2008 01:19 AM
Two step execution stefy Strategy Development 3 05-12-2008 03:19 PM
order execution HelloHello Automated Trading 2 08-29-2007 12:17 AM
Execution on the same bar MrBaffalo Strategy Development 3 01-23-2007 01:57 AM


All times are GMT -6. The time now is 03:58 PM.