I've read through what I could find in the docs re the MA. There didn't seem to be much, but I gather I can call an Indicator just like I can anywhere else. I just want to echo the public variable from the indie to an ma column (which I can't do unless I create some MA code as it is not a plot). I have a problem though in that my OnBarUpdate in my indicator appears to not be running when called from a market analyzer script. There are no errors in the log.
As an example, I have the below code in the indicator
Now, when I call my indicator from within the market analyzer code, like this
private NinjaTrader.NinjaScript.Indicators.TheIndicator TS1;
and
else if (State == State.Configure)
{
TS1 = TheIndicator("");
}
it does indeed print 'LoadingTheIndicator' to the output window from the below code in the indicator, showing it got at least that far. LoadingTheIndicatorOB from the OnBarUpdate in the indicator never does print. It appears OnBarUpdate is not being called (or the print is not being printed). The indicator works perfectly fine and as expected on the chart. No errors occur in the log when you 'reload all ninjascript' from the MA.
else if (State == State.Configure)
{
states = new Series<s tring>(this, MaximumBarsLookBack.Infinite);
myFont = new NinjaTrader.Gui.Tools .SimpleFont("Consolas", fontSize) { Size = fontSiz e, Bold = true };
Print("LoadingTheIndicator...");
}
else if (State == State.DataLoaded)
{
// if (ChartControl != null && Bars.BarsType.IsTimeB ased)
// {
// ChartPeriod = Bars.BarsPeriod.ToString();
// }
}
}
protected override void OnBarUpdate()
{
double entry=0, target=0;
Print("LoadingTheIndicatorOB..."+CurrentBa r);
if (IsFirstTickOfBar)
What super obvious thing am I missing here, please!?
Comment