• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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, 01: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 ralett, Today, 07:29 PM
                1 response
                3 views
                0 likes
                Last Post NinjaTrader_Marco  
                Started by bboyle1234, Today, 10:46 PM
                0 responses
                1 view
                0 likes
                Last Post bboyle1234  
                Started by swcooke, Today, 04:29 PM
                0 responses
                4 views
                0 likes
                Last Post swcooke
                by swcooke
                 
                Started by bboyle1234, Today, 04:27 PM
                0 responses
                2 views
                0 likes
                Last Post bboyle1234  
                Started by swcooke, Today, 03:31 PM
                2 responses
                11 views
                0 likes
                Last Post swcooke
                by swcooke
                 
                Working...
                X