Key concepts in this example:
- Locking in realized profits after a certain amount of gains have been achieved during the trading session
- Cutting realized losses short after a certain amount of losses have been accrued over the trading session
- Preventing aggressive amounts of trading
Important related documentation:
NinjaTrader 8
NinjaTrader 7
* 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.
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.