Using CancelOrder() method to cancel orders
When using NinjaTrader’s Entry and Exit methods, the default behavior is to automatically expire them at the end of a bar unless they are resubmitted to keep them alive. Sometimes you may want more flexibility in this behavior and wish to submit orders as live-until-cancelled. When orders are submitted as live-until-cancelled, the way to cancel them is by using the CancelOrder() method.
Key concepts in this example
- Submitting live-until-cancelled entry orders
- Manually cancelling orders
Important related documentation
Import instructions
- Download the file contained in this Help Guide topic to your PC desktop
- From the Control Center window, select the menu Tools > Import > NinjaScript
- Select the downloaded file