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

Checking for Valid Values in a DataSeries

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

    Checking for Valid Values in a DataSeries

    Hi,

    I've created a Dataseries called X and in the DataSeries, I've come across values which are fictitious i.e there is no rhyme or reason for them. The problem I have now is that these values are plotting on the chart when they shouldn't be.

    I also came across the Checking for Valid Values under DataSeries Class in the NT7 Help manual but have not had success using it.

    I tried "if (X[1].ContainsValue(1) = true), DrawLine....", I get the error message 'double' does not contain a definition for 'ContainsValue.

    How do I actually use ContainsValue? Will it solve my woes?

    Regards
    Kay Wai

    #2
    Hi kaywai, thanks for posting.

    Use ContainsValue like so: X.ContainsValue(0); //most recent bar index. Test out just using this, if this does not solve this issue you are seeing the value calculation will need to be revisited and changed, or more error checking should be added.

    Kind regards,
    -ChrisL
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hi Chris,

      I've attached a screenshot and circled the outlier in red. The max value any of the blue lines should be is the max close over the previous 8 bars. Just don't understand how that outlier appears. It's not even near any close I can reference.

      Regards
      Kay Wai
      Attached Files

      Comment


        #4
        Hi Kay,

        Did you use Print(); to see why this value is being calculated? What code are you using to generate this value? I will need some more details on the exact calculations.

        Kind regards,
        -ChrisL
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Hi Chris,

          I've narrowed it down to the part of the code which causes this issue but the code is using values which it randomly generated from the previous bar - which is the outlier value. I could share the code with you together with the data. Can I email it to you?

          I originally had it all coded on a spreadsheet and then coded it in NinjaScript. I didn't have any of these issues in Excel.

          Regards
          Kay Wai

          Comment


            #6
            Hi Kay Wai,

            Please email scriptingsupport at ninjatrader.com and reference "Attn ChrisL 3279105". I can have a look but will not be able to debug fully. I use the Print() method on a daily basis to debug my scripts. This is how I solve out 90% of bugs I come accross when making new scripts.

            Kind regards.
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Thanks very much Chris. I've just emailed you.

              Noted on the Print() function. I'm not short on them. I can get the outlier to print using the print function but i don't know where the value is coming from. I've also noted the section of the code that uses it.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by SydniBuck, Today, 12:54 AM
              0 responses
              6 views
              0 likes
              Last Post SydniBuck  
              Started by ketostrongbuyno, Yesterday, 11:50 PM
              0 responses
              10 views
              0 likes
              Last Post ketostrongbuyno  
              Started by ReinaKutch, Yesterday, 11:08 PM
              0 responses
              9 views
              0 likes
              Last Post ReinaKutch  
              Started by JackyThur, Yesterday, 10:51 PM
              0 responses
              10 views
              0 likes
              Last Post JackyThur  
              Started by sjeffblack, Yesterday, 01:22 PM
              2 responses
              31 views
              0 likes
              Last Post sjeffblack  
              Working...
              X