I have a bool variable that can be tick on my indicator.
By default the bool is on true. Now if i untick the bool on the chart save as default on template , close and reload my ninjatrader the bool comes back to true
Steps with some screenshot:
Step 1 Load my indicator for the first time:
Step 2 : Untick Show only one apply and save as default template
Step 3 : Close ninjatrader ( saving my chart settings)
Step 4 : open ninjatrader again and unfortunately the Show only one is back ( enabled aKA tick)
I am not sure if there is something on the state that i am doing wrong.
Dummy code that i am doing
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Enter the description for your new custom Indicator here.";
Name = "MyCustomIndicator";
Calculate = Calculate.OnBarClose;
IsOverlay = true;
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;
[B]ShowOnlyCountOne=true;[/B]
}
else if (State == State.Configure)
{
}
}
protected override void OnBarUpdate()
{
//Add your custom indicator logic here.
if(ShowOnlyCountOne == true) {
Print("Show only one");
}
if(ShowOnlyCountOne == false){
Print("Show all");
}
}
[XmlIgnore()]
[Display(Name = "Show only one", GroupName = "Drawing", Order = 1)]
public bool ShowOnlyCountOne
{ get; set; }
}
Thanks

Comment