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

Enabling 2nd DataSeries object kills indicator

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

    Enabling 2nd DataSeries object kills indicator

    I have an indicator with one dataseries plot that works by itself, but when I add a second DataSeries object to the indicator, the original indicator stops plotting. There is no Print output either. As soon as I comment out the DataSeries2.Set(5) line, the indicator works again.

    My intent is to populate the second dataseries object with SUM() data.

    I am using recorded market data captured. Are there any tips I can use to debug other than print, since it doesn't show anything?

    #2
    Are the logs showing you any error if this happens?

    Is the second dataseries being initialized() properly?

    Are you somehow attempting to access a 'nonpresent' value?

    BertrandNinjaTrader Customer Service

    Comment


      #3
      Right now I am just populating the dataseries with a number 5. I've initialized it as DataSeries DeltaSum = new DataSeries(this);

      In the log it reads ...on bar 0: Object reference not set to an instance of an object.

      Comment


        #4
        Tight Face, it is necessary to create and initialize DataSeries in two different locations. It needs to be declared in the variables section, then initialized in the initialize section.
        Code:
        #region Variables
        // Defines the DataSeries object
        private DataSeries myDataSeries;
        #endregion
        
        protected override void Initialize()
        {
        // Create a new DataSeries object and assign it to the variable myDataSeries declared in the ‘Variables’ region above
        myDataSeries = new DataSeries(this);
        }
        If that doesn't solve the issue, could you please post the full code sample of what you're trying to accomplish? Thank you.
        AustinNinjaTrader Customer Service

        Comment


          #5
          Austin,

          I see where my error was.

          In the Initialize method I was typing "DataSeries DeltaSum = new DataSeries(this);" I corrected this and it works now. Thanks!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by andrewtrades, Today, 04:57 PM
          1 response
          9 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by chbruno, Today, 04:10 PM
          0 responses
          6 views
          0 likes
          Last Post chbruno
          by chbruno
           
          Started by josh18955, 03-25-2023, 11:16 AM
          6 responses
          436 views
          0 likes
          Last Post Delerium  
          Started by FAQtrader, Today, 03:35 PM
          0 responses
          8 views
          0 likes
          Last Post FAQtrader  
          Started by rocketman7, Today, 09:41 AM
          5 responses
          19 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X