Step 1: Create an Enumerated type
Exponential = 1,
Weighted = 2
}
Tip B: You don't have to put any numbers after the name, it is just my preference.
Tip C: You can improve the documentation/intellisense by adding a "///" Prefix prior to the enum value. eg:
[Flags]
public enum StopType {
None = 0x00,
SAR = 0x01,
CrossOver = 0x02
};
if (myStop && StopType.SAR) { ...}
Tip E: Declare it Outside of your class.
If you don't, you will need to also change the Property Category to prevent it being a public parameter which means it will not be visible to any other parts of Ninja, ie Strategy etc. (I'll make another post on this)
#region My Global Enums
publicenum SymbolType {
Circle = 1,
Square = 2, ...
}
#endregion
// Note: enums are before this line
//This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
Step 2: Create a Property with its value
As this is really just a number. You don't have to do anything special to serialise it. It will save & restore its settings just fine.
[Category("Parameters")]
[Gui.Design.DisplayName("Moving Average")]
public MAType MovAvgName
{
get { return movAvgName; }
set { movAvgName = value; }
}
Comment