User Variables are very useful for storing values you may want to recall in the future. Another use for User Variables is having it store information that allows you to create conditions that must be executed in a specific sequence. In this example, the strategy will only take trades as the fast period SMA crosses above a slow period SMA and then a normal period SMA.
The attached reference sample demonstrates the following concepts:
- Setting an User Variable
- Checking an User Variable for a value
- Using separate Sets for conditions and actions
- Creating a sequence of conditions before trading
Important conditions and actions 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