Hi there,
this snippet of code below is not allowing me to save the indicator when closing the workspace. I've had no problem in prior versions of NT8. I've read elsewhere it's due to XML serialization/deserialization issues ...... perhaps a null Instrument object?
The full error I am getting is:
Could not save indicator 'MyTwoDataSeriesIndicatorWithPickers:' There was an error reflecting type 'NinjaTrader.NinjaScript.Indicators.MyTwoDataSerie sIndicatorWithPickers'.
namespace NinjaTrader.NinjaScript.Indicators
{
public class MyTwoDataSeriesIndicatorWithPickers : Indicator
{
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Pair1 = Instrument.GetInstrument("EURUSD");
Pair2 = Instrument.GetInstrument("AUDUSD");
}
else if (State == State.Configure)
{
if (Bars != null)
{
AddDataSeries(Pair1.FullName, Bars.BarsType.BarsPeriod.BarsPeriodType, Bars.BarsType.BarsPeriod.Value, MarketDataType.Last);
AddDataSeries(Pair2.FullName, Bars.BarsType.BarsPeriod.BarsPeriodType, Bars.BarsType.BarsPeriod.Value, MarketDataType.Last);
}
}
}
[NinjaScriptProperty]
[Display(Name = "Pair 1", Order = 0, GroupName = "1. Instruments")]
public Cbi.Instrument Pair1 { get; set; }
[NinjaScriptProperty]
[Display(Name = "Pair 2", Order = 1, GroupName = "1. Instruments")]
public Cbi.Instrument Pair2 { get; set; }
}
}
Comment