NinjaScript > Educational Resources > Tutorials > Strategies > Beginner - Simple MA Cross Over > Creating the Strategy via the Wizard |
|
1. Press the "Add" button to display the "Condition Builder" window as per the image below
2. Expand the "Indicators" section by clicking on the "+" button and highlight the "SMA" indicator
3. Select the "Period" property on the lower left window and press the "..." button to open the "Value" window
4. From the "Value" window, expand the "User defined inputs" section and select the "Fast" input
5. Press "OK" to assign the user define input "Fast" to the SMA "Period" property 7. Select "CrossAbove" and set the look back period to a value of "1" 9. Set the "Slow" period (just like you did for Fast in step 4) 10. Enable this indicator to be plotted on a chart
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
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
14. Select the condition as per the image below, right click and select "Copy" from the menu
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 |