NinjaScript > Educational Resources > Tutorials > Indicators > Beginner - Using price variables >

Set Up

Print this Topic Previous pageReturn to chapter overviewNext page

The first step in creating a custom indicator is to use the custom indicator wizard. The wizard will generate the required NinjaScript code that will serve as the foundation for your custom indicator.

 

1. Within the NinjaTrader Control Center window select the Tools-->New NinjaScript-->Indicator... menu

2. Press the "Next >" button

 

Defining Indicator Properties and Name

Below you will define your indicators name and several indicator properties.

 

Tutorials_Indicators_1

 

3. Enter the information as shown above

4. Press the "Next >" button

 

Defining Input Parameters

Below you will define your indicator's input parameters. These are any parameters that can be changed by the user and used in the calculation of the indicators value(s). If your indicator does not require any parameters leave the "Name" fields blank.

 

Tutorials_Indicators_2

 

5. This indicator does not require any input parameters

6. Press the "Next >" button

 

Defining Plots

Below you will define how  your indicator is plotted on a chart.

 

Tutorials_Indicators_3

 

7. Enter the information as shown above. Note that we changed the "Color" to "Orange" and the "Type" to "Bar"

8. Press the "Next >" button

 

Defining Oscillator Lines

Below you will define any required oscillator lines. This would be the "Zero" line in the CCI indicator for example. If your indicator does not require any oscillator lines leave the "Name" fields blank.

 

Tutorials_Indicators_4

 

9. Enter the information as shown above (make sure the "Name" fields are blank since we do not need an oscillator line for a simple moving average indicator)

10. Press the "Next >" button

11. We are now finished entering in our indicator set up information. Press the "Finish" button.

 

* At any time, you can press the "Generate" button in the wizard if you do not need to go through each of the wizard steps.

 

You will now see the NinjaScript Editor preloaded with NinjaScript code generated by the wizard. It should look something like the image below.

 

Tutorials_Indicators_5

 

Your primary area of concern will be sections "2" and "3".

 

1. This section provides the indicator with the chart display name and description used in the Indicator Dialog window.

2. The Initialize() section is processed only once when the indicator is initially loaded (added to a chart for example) and can be used to set up any indicator configuration requirements. You can see that this wizard generated code that added the plot color and style that we defined.

3. This is the section that is called on each bar update (incoming tick) and is where you will enter your indicator logic