NinjaScript > Educational Resources > Reference Samples > Strategy >

Using User Variables in the Strategy Wizard

Print this Topic Previous pageReturn to chapter overviewNext page

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

•CrossAbove
•Numeric value
•Set user defined variable

 

Import instructions

1.Download the file contained in this Help Guide topic to your PC desktop
2.From the Control Center window, select the menu File > Utilities > Import NinjaScript
3.Select the downloaded file and click Import.

 

SampleUserVariables.zip