NOTE: This is a real-time strategy only. You will also need to first setup an ATM template titled "AtmStrategyTemplate" for this sample to work. You can set this up in the SuperDOM or Chart Trader windows.
Key concepts in this example:
- Obtaining unrealized and realized profit/loss from ATM templates initiated by a NinjaScript strategy
- Keeping a running total of all the realized profits/losses
Important related documentation:
NinjaTrader 8
- GetAtmStrategyRealizedProfitLoss()
- GetAtmStrategyUnrealizedProfitLoss()
- Draw.TextFixed()
- RoundToTickSize()
NinjaTrader 7
- GetAtmStrategyRealizedProfitLoss()
- GetAtmStrategyUnrealizedProfitLoss()
- DrawTextFixed()
- Round2TickSize()
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.