Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SMA method returning NaN, SMA is not validating input, bug

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

    SMA method returning NaN, SMA is not validating input, bug

    I'm passing a new Series<double> to SMA

    for some reason, the first bar of this custom series has no value yet, so it is NaN

    When the SMA method receives the NaN as it's input, it tries to calc a sum, which then makes the class internal variable priorsum be NaN, and the issue continues for each additional bar input ...


    Please consider a validation check inside the SMA indicator, if the input is Nan, set it's value = 0;

    #2
    Hello balltrader,

    I am happy to submit a feature request on your behalf.

    However, do understand using a 0 will drastically change the value of the moving average.

    Once I have a tracking ID for this request I will forward this to you for future reference.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Maybe the problem is with custom series here.
      Not sma.

      Comment


        #4
        the prob is with input to SMA.
        input from custom series is Nan. (custom series is populated from built-in indicator StdError. First bar results in Nan)

        The way SMA handles an input with value of NaN is the bug.

        Comment


          #5
          Hi ChelseaB

          maybe if Input[0] is Nan, just exit the routine?

          it might be complicated...

          if Input[Period] is Nan, then how do you handle the error?
          Do you set the return value of SMA to the previous value?

          Comment


            #6
            Originally posted by balltrader View Post
            the prob is with input to SMA.
            input from custom series is Nan. (custom series is populated from built-in indicator StdError. First bar results in Nan)

            The way SMA handles an input with value of NaN is the bug.
            Your assertion is right, but I would think that the more important matter is what you will do about it while you wait for NT to come up with a fix, if ever.
            1. Write your own SMA with an appropriate Nan filter, and use it for your specific instance requirement, or
            2. Write your custom indicator/series to handle and pass some other value when it will output Nan.

            FWIW, Just offering my $0.02 view as to how I would handle it.
            Last edited by koganam; 04-25-2018, 02:10 PM.

            Comment


              #7
              already did #1 and #2

              it's worth 2 cents, lol
              thanks

              Comment


                #8
                Hello balltrader,

                I've received a tracking ID for your request.

                Your request for the SMA indicator to replace NaN values with 0s is being tracked with ID #SFT-3163.

                Please note it is up to the NinjaTrader Development to decide if and when any request will be implemented.

                Thank you for your suggestion.
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by algospoke, 04-17-2024, 06:40 PM
                3 responses
                26 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by bmartz, 03-12-2024, 06:12 AM
                3 responses
                30 views
                0 likes
                Last Post NinjaTrader_Zachary  
                Started by Aviram Y, Today, 05:29 AM
                2 responses
                10 views
                0 likes
                Last Post Aviram Y  
                Started by gentlebenthebear, Today, 01:30 AM
                1 response
                8 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by cls71, Today, 04:45 AM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Working...
                X