I notice that in some cases, NT can't save templates due a failure on Indicator class reflection. I finally found a solution, but it was giving my nuts.
I made a simple example to show the issue.
namespace NinjaTrader.NinjaScript.Indicators {
public class [B]MyOrder[/B] { // Simple demo class
public double price;
public MyOrder(double price=0) {
this.price = price;
}
}
public class MyIndicator : Indicator {
[B]public MyOrder signal_entry; [/B] // the reflection fails when this line is uncommented
protected override void OnStateChange() {
switch (State) {
case State.SetDefaults: {
Description = @"My Indicator base classs";
Name = this.GetType().Name;
Calculate = Calculate.OnBarClose;
IsOverlay = false;
DisplayInDataBox = true;
DrawOnPricePanel = false;
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;
break;
}
case State.Configure: {
AddLine(Brushes.Yellow, 0, "Zero");
break;
}
}
}
protected override void OnBarUpdate() {
Print("I'm alive:" + Time[0]);
}
#region Properties
#endregion
}
}
Even more surprising is the fact that if I declare protected this member, everything works fine.
Can anyone give me a hint about that problem?, seems a design decision, not really a problem.
--
Asterio

Comment