NinjaScript > Educational Resources > Tutorials > Strategies > Beginner - Simple MA Cross Over >

Creating the Strategy via the Wizard

Print this Topic Previous pageReturn to chapter overviewNext page

1. Press the "Add" button to display the "Condition Builder" window as per the image below

 

Tutorials_Strategies_4

2. Expand the "Indicators" section by clicking on the "+" button and highlight the "SMA" indicator

 

Tutorials_Strategies_5

 

3. Select the "Period" property on the lower left window and press the "..." button to open the "Value" window

 

Tutorials_Strategies_6

 

4. From the "Value" window, expand the "User defined inputs" section and select the "Fast" input

 

Tutorials_Strategies_7

 

5. Press "OK" to assign the user define input "Fast" to the SMA "Period" property
6. Enable this indicator to be plotted on a chart

7. Select "CrossAbove" and set the look back period to a value of "1"
8. Select "SMA" indicator in the right window

9. Set the "Slow" period (just like you did for Fast in step 4)

10. Enable this indicator to be plotted on a chart

 

Tutorials_Strategies_8

 

If you look at the image above, you just created an initial condition. The condition is "if the fast simple moving average crosses above the slow simple moving average".

 

11. Press the "OK" button and you will see the following image

 

Tutorials_Strategies_9

 

12. Press the "Add" button in the lower right section of the Wizard to bring up the "Strategy Action" dialog window

13. Expand the "Order management" section by clicking on the "+" button and highlight the "Enter Long position" action and then press the "OK" button

 

Tutorials_Strategies_10

 

14. Select the condition as per the image below, right click and select "Copy" from the menu
15. Click on the "Set 2" tab and move your cursor into the conditions area, right click and select "Paste" from the menu

 

Tutorials_Strategies_17

 

16. Press the "..." button for the copied condition which will bring up the Condition Builder

17. In the Condition Builder, change the "CrossAbove" function to "CrossBelow"

18. We also want to set to "false" the "Plot on chart" parameters (Step #6) since we already set them to true on "Set 1" tab

19. Press the "OK" button

20. Repeat steps #12 and #13 except substituting "Enter short position" for "Enter long position"

21. Complete the remainder of the wizard by pressing the "Next >" button