NinjaScript > Editor >

Automatically Inserting Actions and Conditions

Print this Topic Previous pageReturn to chapter overviewNext page

 

 

The NinjaScript Editor can automatically generate code for you.  You can access this option by clicking on your right mouse button within the NinjaScript Editor window and selecting either the menu name  "Insert Action..." and/or "Insert Condition...". These features can help you in your learning curve of NinjaScript and C# and also provide correct syntax in the event that you need a little assistance.

 

Note: This feature is only available when editing NinjaScript strategies

NS_Editor_6

 

 

Using the image below for an example

1. After typing in "if (" right mouse button click and select "Insert Condition..."

2. The Condition Builder will appear which allows you to point and click to create conditions. Below we have build a condition that checks to see if the 5 period EMA has crossed above the 15 period EMA within the last bar.
3. Press "OK" to have the Condition Builder generate the NinjaScript program code

 

NS_Editor_7

 

4. The result is the code generated below.

 

 

NS_Editor_8