Announcement

Collapse
No announcement yet.

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?

    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 CarlTrading, 03-31-2026, 09:41 PM
          1 response
          152 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          87 views
          1 like
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          131 views
          2 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          127 views
          1 like
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          106 views
          0 likes
          Last Post CarlTrading  
          Working...
          X