Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bar Index needs to be greater/equal 0

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

    Bar Index needs to be greater/equal 0

    I'm getting an ArgumentException in a multi-timeframe indicator. I don't quite understand why this would be an issue since I am calling the Count property of the timeseries to find the end of the array. It should correspond to the number of BarsAgo and return the 1st DateTime in chart.

    Times[1][Times[1].Count - 1]
    => 'Times[1][Times[1].Count - 1]' threw an exception of type 'System.ArgumentException' System.DateTime {System.ArgumentException}

    Times[1][Times[1].Count - 7]
    => {3/3/2015 3:00:00 PM} System.DateTime

    I'm calling this code in this if statement:
    if(Historical && BarsInProgress == 1 && Times[1].Count - 2 == CurrentBar){

    }

    Why is it Times[1].Count - 7, instead of Times[1].Count - 1?
    Last edited by habibalex; 03-09-2015, 06:58 PM.

    #2
    habibalex, you mean rather why it would be the Count - 1 with the exception instead of the Count -7? What series are you dealing with here and how would the be loaded from the data series window? Do you load based on days back? Is it the same outcome for other instruments, so we could rule out potential cache issues for this market?

    On which series do you run the returned index? Would this be a custom series that may potentially not be synched to the added series but as default for the primary?

    Comment


      #3
      Yes I am getting an exception with Times[1].Count - 1.
      I add a dataseries in the initialize function, I get the error w/ both 6E and ES:
      Add(PeriodType.Tick,1);

      Comment


        #4
        Habibalex,

        Would you be willing to attach your script or a toy script that reproduces this so I can review and investigate this.
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          can i email it to you?

          Comment


            #6
            That would be fine

            Send it to platformsupport [at] ninjatrader [dot] com

            Put ATTN Cal in the subject and reference this thread in the body
            Cal H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

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