PDA

View Full Version : Indicator: Creating a user-defined parameter type (enum)


NinjaTrader_Josh
09-24-2007, 10:12 PM
Creating user-defined parameters allows you to present the user with hard coded options they can choose. These options provide flexibility in your indicators and can be of value to the user if they like to switch settings often.

The attached reference sample demonstrates the following key concepts:

Hard code various Moving Average types the user can select
Use a switch to determine which code logic is executed based on the Moving Average type selected

Important methods and properties used include:

enum (http://www.csharp-station.com/Tutorials/Lesson17.aspx)
switch (http://www.ninjatrader.com/support/helpGuides/nt7/branching_commands.htm)

Import instructions:

Download the file contained in this thread to your PC desktop
From the Control Center window, select the menu File > Utilities > Import NinjaScript
Select the downloaded file