NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


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 10-16-2007, 12:32 AM   #1
newguy
Junior Member
 
Join Date: Oct 2007
Posts: 2
Thanks: 0
Thanked 0 times in 0 posts
Default Determining if an indicator value is null

I created an indicator in which only some of the DataSeries items are assigned values. When I access an indicator value that happens to be null:

double d = MyIndicator().Plot0[0];

...the closing price of the current bar is assigned to variable d. Is that normal behavior? How can I determine if the current value of the indicator is null? I don't want to assign an arbitrary value because the value is plotted. I tried using the Reset() method but got the same results. Btw, the indicator plots fine on a chart.
newguy is offline  
Reply With Quote
Old 10-16-2007, 12:50 AM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

You should be able to assign null values to your DataSeries. Please check out this page http://www.ninjatrader-support.com/H...taSeriesObject

Here is an excerpt from it pertaining to your case:
"Calling the Reset() method is unique and can be very powerful for custom indicator development. DataSeries objects can hold null values which simply means that you do not want to store a value for the current bar. Mathematically, you can correctly assign a value of zero however if the DataSeries was the primary DataSeries of an indicator whose values would be used for plotting, you may NOT want a zero value plotted. Meaning, you want a zero value for proper calculations but not a zero value for chart visualization. The Reset() method allows you to reset the current bar's DataSeries value to a zero for calculation purposes but NinjaScript would ignore this value when it plotted it on a chart."
NinjaTrader_Josh is offline  
Reply With Quote
Old 10-16-2007, 12:57 AM   #3
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

We'll look into and let you know.
NinjaTrader_Dierk is offline  
Reply With Quote
Old 10-16-2007, 08:30 AM   #4
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

NT6.5 (first beta in 2 weeks) will have a "ContainsValue" method at the series to determine if there is a custom-set value in or no.
NinjaTrader_Dierk is offline  
Reply With Quote
Old 10-16-2007, 04:16 PM   #5
newguy
Junior Member
 
Join Date: Oct 2007
Posts: 2
Thanks: 0
Thanked 0 times in 0 posts
Default

Ok, I'll look forward to the NT 6.5 beta. Thanks both Dierk and Josh for your quick responses!
newguy 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
Determining Market Position daven Automated Trading 1 09-27-2007 07:41 AM
Using Strategy Wizard to develope Indicator on Indicator mrlucky1x Indicator Development 3 08-25-2007 04:09 PM
Determining "Last Bar On Chart" NinjaTrader_Ray General Programming 2 01-16-2007 03:17 PM


All times are GMT -6. The time now is 08:40 AM.