To create a new NinjaScript strategy select the menu Tools-->New NinjaScript-->Strategy from within the Control Center window.
Whether you are going to self program your strategy or use the wizard exclusively, a strategy is always initially created via the wizard.
The Opening Screen
1. Press the "Help" button to open the NinjaTrader Help documentation
2. Press the "View Code..." button at any time to view the wizard generated NinjaScript code
3. Press the "Unlock Code" button at any time to open the NinjaScript editor and edit your strategy code. Once the code is unlocked you can no longer user the wizard for subsequent strategy editing.
4. Press the "<Back" or "Next>" buttons to move back for forth between wizard screens
5. Press the "Cancel" button to leave the wizard
The General Screen
1. Sets the name of the strategy
2. Description of the strategy
3. Enables or disables the default setting for CalculateOnBarClose (can override when starting a strategy)
The User Defined Inputs Screen
This screen allows you to define user defined inputs of your strategy. User defined inputs are important if you require input values that may vary the performance of your strategy. If for example you have simple moving average cross over system, you may want to create an input for the fast moving average and another for the slow moving average. This then allows you to change the values of the moving averages at run time. Inputs are also required if you plan to use the Strategy Optimizer or the Walk Forward Optimization.
1. Sets the name of the input
2. Sets the value type of the input to either "int" (integer value - whole numbers) or a "double" (double value - decimals) or a "bool" (true or false) or a "string"
3. Sets the default value of the input
4. Sets the minimum value of the input
5. Sets the description for the input
The Conditions and Actions Screen
This screen allows you to set conditions and subsequent actions that control the flow of your strategy.
Conditions - Take the speficied action when true
Actions - Execute an action (submit orders, draw objects on the chart etc...) based on its parent condition evaluating to true
Via the wizard, you can have up to ten different condition sets with related actions. If you require more than ten condition sets then you should self code your strategy via the NinjaScript Editor. Conditions are created using the Condition Builder. Actions are specified by the Strategy Action window.
1. Selects the condition set you wish to edit
2. Displays conditions associated with the currently selected condition set
3. Add or delete a condition
4. Edits the currently selected condition
5. Displays the actions associated with the currently selected condition set
6. Add or delete an action
7. Edits the currently selected action
You can copy and paste conditions from one set to another and you can even save a condition set as a template and load for future use via the right mouse button click context menu as show in the image below. You can also save a condition set as a template (selecting the "Save As..." menu) and then re-use it in another strategy at a later time by selecting the "Load..." menu.
The Stops and Targets Screen
This screen allows you to set stop loss, trail stop and profit target orders that are automatically submitted and managed once your strategy opens a position. Stops and targets are added by the Strategy Action window.
1. Displays stops and targets associated with your strategy
2. Adds or deletes a stop or target
3. Edits the selected stop or target
The Finished Screen
Once you reach this screen you are finished with developing your strategy. Press the "Finish" button to compile your strategy which will then be ready for testing or live execution.