I have a simple Enum
{
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Enter the description for your new custom Indicator here.";
Name = "Enums";
Calculate = Calculate.OnBarClose;
IsOverlay = false;
DisplayInDataBox = true;
DrawOnPricePanel = true;
DrawHorizontalGridLines = true;
DrawVerticalGridLines = true;
PaintPriceMarkers = true;
ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
//Disable this property if your indicator requires custom values that cumulate with each new market data event.
//See Help Guide for additional information.
IsSuspendedWhileInactive = true;
}
else if (State == State.Configure)
{
}
}
protected override void OnBarUpdate()
{
//Add your custom indicator logic here.
}
}
}
namespace ENUMS
{
public enum INDICATORS
{
UO,
MACD,
RSI,
Stoch,
StochRSI,
Multi
}
}
I use that as the first input into my Indicator, BBDivergence. This works great. There are 3 other inputs, all bool.
[Display(GroupName = "Parameters", Description="Choose an Indicator.")]
public ENUMS.INDICATORS IndyType
{
get { return indyType; }
set { indyType = value; }
}
[NinjaScriptProperty]
[Display(Name="ShowDivergenceLines", Description="", Order=2, GroupName="Parameters")]
public bool ShowDivergenceLines
{ get; set; }
[NinjaScriptProperty]
[Display(Name="ShowPriceDots", Description="", Order=3, GroupName="Parameters")]
public bool ShowPriceDots
{ get; set; }
[NinjaScriptProperty]
[Display(Name="UseLightBackground", Description="", Order=4, GroupName="Parameters")]
public bool UseLightBackground
{ get; set; }
[Browsable(false)][XmlIgnore()]
public Series<int> Divergence {get {return divergence;}}
#endregion
}
I have another indicator where I want to use the output of BBDivergence. But when i try to pass the Enum as a parameter so that I can use the output of BBDivergence, I get an error
{
//Add your custom indicator logic here.
divergence = BBDivergence(ENUMS.INDICATORS.UO, false, true, false).Divergence[0];
if(Math.Abs(divergence) == 1)
{
DrawDivergence();
}
}
If I leave the enum out of the paameters and only pass the 3 bools, it works, but only for the first choice from the enum list. I'd like to call BBDivergence for each Enum value.
What am I doing wrong.
Comment