Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Determining if an indicator value is null

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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.

    #2
    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."
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      We'll look into and let you know.

      Comment


        #4
        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.

        Comment


          #5
          Ok, I'll look forward to the NT 6.5 beta. Thanks both Dierk and Josh for your quick responses!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by pibrew, Today, 06:10 PM
          0 responses
          4 views
          0 likes
          Last Post pibrew
          by pibrew
           
          Started by pibrew, 04-28-2024, 06:37 AM
          2 responses
          17 views
          0 likes
          Last Post pibrew
          by pibrew
           
          Started by Philippe56140, 04-27-2024, 02:35 PM
          7 responses
          56 views
          0 likes
          Last Post kevinenergy  
          Started by arunkumar3, 08-25-2023, 12:40 PM
          3 responses
          169 views
          0 likes
          Last Post Trader2024!  
          Started by DJ888, 04-26-2024, 10:57 PM
          2 responses
          17 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Working...
          X