PDA

View Full Version : Indicator stops updating sometimes


maxpi
11-08-2007, 07:15 PM
The following code stops plotting to the chart all the time when running on intraday data and updating every tick. If I format the indicators it will update but it will stop again after awhile. When it stops updating the plot to the chart, I believe it also does not alert but it does continually update the number at the right of the screen.

{
if (CurrentBar < 4)
return;
if (Bars.PercentComplete>0)
{
Plot0.Set(Volume[0] /Bars.PercentComplete);
}


if (Volume[0] /Bars.PercentComplete > 1.2 *Volume[1])
{
if (alarmOn ==1)
{
Alert("myAlert", NinjaTrader.Cbi.Priority.High, "PRV", "Alert1.wav", 90, Color.Black, Color.Yellow);
}
}

}

NinjaTrader_Ray
11-08-2007, 07:57 PM
If an indicator stop working you will see an error message in the log of the Control Center window with some idea of the error being generated. If the indicator stops plotting, you will have to do some further debugging to see why the Plot0.Set() method is not being called...or what value is actually being set.

KBJ
11-08-2007, 10:17 PM
I already solved this one a couple of weeks ago. I'd bet you're still getting a divide by zero.

See: http://www.ninjatrader-support.com/vb/showthread.php?t=3761

maxpi
11-09-2007, 10:28 AM
Shoot, I protected it against divide by zero in the first part of the code but not in the alert part... thanks...

maxpi
11-14-2007, 09:02 AM
Even after getting all the divide by zero problems out of the code it still stopped plotting exactly the same. I had to move the plot0 statement so it was not dependent on the Bars.PercentComplete>0 condition, now it seems to run all the time like it should.