Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Maximum Bars Lookback

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

    #16
    Yes.

    Originally posted by NinjaTrader_Bertrand View Post
    Hi Harry, thanks for clarifying and adding those remarks, appreciated.

    Do you see the same result if setting the lookback for the DateTimeSeries programmatically to be infinite?
    But I think Josh is right, I will try to produce an indicator that is stripped down of much of the code, and which shows the same behavior. I will come back once I have coded it.

    Comment


      #17
      NT 7 not as clean as NT 6.5

      I have explored the problem and found an explanation. There was a bug in the indicator, which in some cases prevented that a value was written to the DateTimeSeries. In such a case NT7 behaves in a different way than NT 6.5. This can be shown with the following simple indicator, which prints the result to the output window:

      #region Variables
      private DateTimeSeries someDate;
      #endregion
      protected override void Initialize()
      {
      someDate =
      new DateTimeSeries(this);
      }
      protected override void OnBarUpdate()
      {
      if ( Time[0].DayOfWeek == DayOfWeek.Monday)
      someDate.Set(Time[
      0]);
      Print (CurrentBar +
      " " + Convert.ToString(someDate[0]));
      }

      With this indicator, values are written to the DateTimeSeries only on Monday. Nothing is written to the DateTimeSeries for the other days. So what happens?

      NT 6.5. -> On Mondays the DateTimeSeries contains the affected values, on all other days the DateTimeSeries contains the default value "01.01.0001 00:00:00".

      NT 7.0.0.13 set to "TwoHundredFiftySix" -> On Mondays the DateTimeSeries contains the affected values, on all other days the DateTimeSeries contains either "01.01.0001 00:00:00" or random values from prior fields of the DateTimeSeries.

      NT 7.0.0.13 set set to "MaximumBarsLookBack.Infinite" via indicator dialogue -> "Error on calling 'OnBarUpdate' method for indicator 'Test' on bar 0: You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart."

      Conclusion: If you do not affect a value to the DateTimeSeries,

      - NT 6.5. writes the default value
      - NT 7 (TwoHundredFiftySix) writes random values
      - NT7 (Infinite) creates an out-of-range exception.

      I don't think that the solution adopted for NT is really clean here.
      Last edited by Harry; 04-03-2010, 12:35 PM.

      Comment


        #18
        Hi Harry, thanks for your efforts to simplify this, I could reproduce the behavior you found on 65 vs 7 - we'll take a look into.

        Comment


          #19
          Harry, development informed this is expected behavior - you should only access a DataSeries for data points where you actually have set values for it.

          Comment


            #20
            Thanks Bertrand, for checking. I fully agree with the statement below.

            Originally posted by NinjaTrader_Bertrand View Post
            Harry, development informed this is expected behavior - you should only access a DataSeries for data points where you actually have set values for it.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            605 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            351 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            560 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            561 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X