Key concepts in the SampleHaltBasicStrategy example*
- Using PnL statistics to determine when to halt processing of the strategy
- Cancelling active orders
- Closing active positions
Key concepts in the SampleHaltAdvancedStrategy example**
- Using a custom method to halt processing on all event-driven methods
- Advanced order handling in error situations with the OnOrderUpdate() method
* This is intended for strategies driven exclusively by the OnBarUpdate() method.
** This sample's intended audience is for advanced programmers who have programmed strategies that take advantage of event-driven methods such as, but not limited to, OnMarketData() or OnOrderUpdate() in addition to the OnBarUpdate() method.
Important related documentation:
NinjaTrader 8
* This reference sample uses the .AllTrades property. This property will include all historical virtual trades as well as real-time trades. If you wish to only make calculations based on real-time trades you can use the .RealtimeTrades property.
NinjaTrader 7
Import instructions:
NinjaTrader 8
- Download the file contained in this thread to your PC desktop
- From the Control Center window, select the menu Tools > Import > NinjaScript
- Select the downloaded file
NinjaTrader 7
- Download the file contained in this thread to your PC desktop
- From the Control Center window, select the menu File > Utilities > Import NinjaScript
- Select the downloaded file and click Import.