Indicator ind=SMA(14);
Now I'm trying to do the same using reflection (I don't know the name of the indicator)
Type type=Assembly.GetExecutingAssembly().GetType("NinjaTrader.NinjaScript.Indicators.Indicator"); MethodInfo mi = type.GetMethod("SMA",new Type[] { typeof(Series<double>), typeof(int) }); Object obj = Activator.CreateInstance(type); Indicator ind2=(SMA)mi.Invoke(obj, new object[] { BarsArray[0],14 });
but when I try to access the data
double d=ind2[0];
'SMA' tried to load additional data. All data must first be loaded by the hosting NinjaScript in its configure state
Can you help me with this?
Or maybe there is another way to access the indicator without knowing its name in advance?
Comment