Reference sample for NinjaTrader 6.5.XXXX.X or greater.
For money management reasons you may want to limit your strategy from aggressive daytrading or you may want to cut your losses short on volatile sessions that are not playing out in your favor. This can be done through the utilization of the Performance object.
The attached reference sample demonstrates the following concepts:
- 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 methods and properties include:
* 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.
Other methods and properties of interest include:
Import instructions for NinjaTrader 6.5.XXXX.X or greater:
- 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