NinjaScript > Educational Resources > Reference Samples > Strategy >

Keeping orders alive

Print this Topic Previous pageReturn to chapter overviewNext page

The default behavior for NinjaTrader is to cancel limit orders if the trigger conditions are no longer true. It is possible to submit orders that stay active until cancelled by setting liveUntilCancelled to true. This sample demonstrates and explains the difference between submitting an order with isLiveUntilCancelled true and false. The comments contain a longer, more detailed explanation.

 

Key concepts in this example

How to submit an order that stays active until it is explicitly canceled*

*Another sample demonstrating how to explicitly cancel orders can be found here: Using CancelOrder() method to cancel orders

 

 

Important related documentation

EnterLongLimit()
liveUntilCancelled
CrossAbove()
CrossBelow()

 

Import instructions

1.Download the file contained in this Help Guide topic to your PC desktop
2.From the Control Center window, select the menu File > Utilities > Import NinjaScript
3.Select the downloaded file and click Import.

 

SampleLiveUntilCancelled_NT7.zip