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 Hwop38, 05-04-2026, 07:02 PM
            0 responses
            173 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Started by CaptainJack, 04-24-2026, 11:07 PM
            0 responses
            328 views
            0 likes
            Last Post CaptainJack  
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            252 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            354 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            181 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Working...
            X