Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

'accessing an index with a value that is invalid'

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

    'accessing an index with a value that is invalid'

    Good morning,

    I havent seen this error before, and it is annoying for 2 reasons:
    1. The data has been in use for some time and has never given this issue before
    2. The logic of the error is weird (for me, at least YMMV)

    These are the errors, and they only appeared the times I have copied here. The WMA has a maximum test during optimization of 32 bars, and FisherTransform of 11 .... the CurrentBar settings are >200 on the OnBarUpdate() ...


    Error on calling 'OnBarUpdate' method for indicator 'WMA' on bar 49:
    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.

    Error on calling 'OnBarUpdate' method for indicator 'FisherTransform':
    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.

    Error on calling 'OnBarUpdate' method for indicator 'FisherTransform' on bar 1584:
    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.,


    So how can I have a lack of data at bar 1584?
    How can I locate that bar in the chart of the Strategy Analyzer without manually counting?

    Once again, Thanks !
    Jon
    Last edited by Trader.Jon; 12-16-2010, 08:14 AM.

    #2
    Hello,

    Thanks for the post.

    Are you using multi series or added in another bar series object?

    Also, Are you sure that you have data?

    If so, I would have to look into your code to see whats going on as of currently I do not have a guess at this point in time.

    I look forward to assisting you further.
    BrettNinjaTrader Product Management

    Comment


      #3
      Hi Brett,

      I have added in 3 additional BArsArray for the strategy.

      I am sure there is data, and there is output in the trades and charts of Strategy Analyzer.

      Basically I am looking for an EASY way to locate bar 1584 to see if there is data damage of some kind ... ie I want to find it before I restart the optimization to see if it happens again.

      TY,
      Jon

      Comment


        #4
        Hello,

        In this case you will need to check that you have enough data on each Barsarray as CurrentBar only does the main array.

        Please see this for an example:



        You will need to add another check for the 3rd Bars Array then what you see in the example..

        Let me know if I can be of further assistance.
        BrettNinjaTrader Product Management

        Comment


          #5
          Brett,

          This directly from my code:


          protected override void OnBarUpdate()
          {
          if (CurrentBars[0] < 200 || CurrentBars[1] < 200 || CurrentBars[2] < 150 || CurrentBars[3] < 200 )
          return;

          Still looking for an easy way to find that bar ... it does appear that there are holes in my historical $EURUSD data that is not backfilled from the NT server when I 'reload all historical data' on range bar chart ...this data was originally from the GAIN source and supplemented from NT server .. when I check my folders for $EURUSD in the tick folder I only find 4750 folders for 201001011200 to 201009262300 ... my guesstimate is about 100 missing ..

          Jon

          Comment


            #6
            Hello,

            Gaps shouldnt effect this.

            Would need to take a look at full code then to start chopping out code until I find out whats causing it. As the information provided here in the thread looks good.

            I look forward to assisting you further.
            BrettNinjaTrader Product Management

            Comment


              #7
              Hello,

              Please send your code to support at ninjatrader dot com and attn: brett reference this forum post so that I may give your code a quick run.

              I look forward to assisting you further.
              BrettNinjaTrader Product Management

              Comment


                #8
                Brett,

                I will consider that offer ... in the interim I found that

                1. This doesnt happen at all during a backtest on any timespan that includes the 'fault area' in that timespan
                2. My 'guesstimate' of the bar# that is specified as the 'fault bar' shows that it is at start of a week ie Sunday 5pm eastern. I I seem to recall there were threads in the forums referencing that type of issue but cant seem to locate them

                Any thoughts on the two points above?

                Comment


                  #9
                  Hello,

                  What session template are you using running this live vs backtest?

                  If you change the session template to RTH does this effect anything?
                  BrettNinjaTrader Product Management

                  Comment


                    #10
                    I am not running live yet ... session template is set to 'forex' for optimizations and backtesting the optimization results to make sure they synch together ... RTH shouldnt apply as I trade the 0305 >> 1500 eastern timeperiod (or is that an issue)

                    Jon

                    Comment


                      #11
                      Hello,

                      Shouldnt be an issue, just was an idea to run as a quick test to see if the post you recalled of some sort of issue was cousing a problem with that certain date range. The session template change would be a good way to test this.

                      Otherwise,I'm still taking shots in the dark and unsure as to why this would occur until I look at the code.

                      I look forward to assisting you further.
                      BrettNinjaTrader Product Management

                      Comment

                      Latest Posts

                      Collapse

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