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 12-27-2009, 03:41 PM   #1
boreland
Junior Member
 
Join Date: Aug 2009
Posts: 29
Thanks: 0
Thanked 1 time in 1 post
Default CancelOrder() problem

When using the CancelOrder() method I'm finding that the order is not canceled immediately, but rather at the start of a new bar. Is it supposed to work like this?

When I create an order through chart trader, and then close the order, it closes immediately. How can I achieve this level of response programatically?

Thanks
Peter

Update: O.K. After many hours I've got this issue sorted, one must use this limit order method -

EnterLongLimit(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double limitPrice, string signalName) and not the short version. It would be helpful if a note could be added to the help guide on this issue.
Last edited by boreland; 12-27-2009 at 03:56 PM.
boreland is offline  
Reply With Quote
Old 12-28-2009, 05:33 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,377
Thanks: 252
Thanked 966 times in 949 posts
Default

Hi boreland, correct you would need to use the extended overload in multiseries context to submit to the need bars object, but not sure I fully follow on what you expected from CancelOrder() - it would depend mostly if you run the strategy on each tick or not (CalculateOnBarClose setting).

For the EnterLongLimit, the orders just expires at the end of each bar if not resubmitted or set to liveUntilCancelled.
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
NinjaTrader crashes when I load strategy with CancelOrder() leontancfa Strategy Development 7 09-17-2009 07:49 AM
Strategy: Using CancelOrder() method to cancel orders NinjaTrader_Josh Reference Samples 0 07-20-2009 01:51 PM
How CancelOrder() work? xewoox Strategy Development 6 02-18-2009 02:21 PM
Simple Limit Strategy with CancelOrder stefy Strategy Development 7 11-10-2008 07:44 AM
CancelOrder() problem John833 Strategy Development 41 10-31-2008 03:15 PM


All times are GMT -6. The time now is 05:42 AM.