NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 11-08-2007, 07:15 PM   #1
maxpi
Senior Member
 
Join Date: Jun 2007
Posts: 151
Thanks: 0
Thanked 0 times in 0 posts
Default Indicator stops updating sometimes

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);
}
}

}
maxpi is offline  
Reply With Quote
Old 11-08-2007, 07:57 PM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

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.
NinjaTrader_Ray is offline  
Reply With Quote
Old 11-08-2007, 10:17 PM   #3
KBJ
Senior Member
 
Join Date: Mar 2007
Location: , Florida, USA
Posts: 663
Thanks: 36
Thanked 7 times in 6 posts
Default

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/v...ead.php?t=3761
KBJ is offline  
Reply With Quote
Old 11-09-2007, 10:28 AM   #4
maxpi
Senior Member
 
Join Date: Jun 2007
Posts: 151
Thanks: 0
Thanked 0 times in 0 posts
Default

Shoot, I protected it against divide by zero in the first part of the code but not in the alert part... thanks...
Last edited by maxpi; 11-09-2007 at 10:31 AM.
maxpi is offline  
Reply With Quote
Old 11-14-2007, 09:02 AM   #5
maxpi
Senior Member
 
Join Date: Jun 2007
Posts: 151
Thanks: 0
Thanked 0 times in 0 posts
Default

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.
maxpi is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bid/Ask spread indicator updating even if no trades take place RedDuke General Programming 10 05-12-2008 03:29 PM
chart stops updating deanldavis475 Charting 32 10-01-2007 05:42 PM
Problem with updating indicator at new day max1ci6 Indicator Development 8 08-17-2007 08:22 AM
when updating an indicator Thomas Indicator Development 2 08-12-2007 03:02 PM
Updating V4 to V5 underground Automated Trading 1 01-03-2006 02:56 AM


All times are GMT -6. The time now is 01:31 PM.