Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error on calling 'OnBarUpdate' method

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

    Error on calling 'OnBarUpdate' method

    Fixed thanks!
    Last edited by llstelle; 11-13-2012, 12:08 PM.

    #2
    llstelle, I would suggest you look into adding try / catch standard C# exception handing to get a better understanding where your code needs modifications to address this issue - http://www.ninjatrader.com/support/f...ead.php?t=9825

    Comment


      #3
      Fixed thanks!
      Last edited by llstelle; 11-13-2012, 12:09 PM.

      Comment


        #4
        Originally posted by llstelle View Post
        Hi, thanks for the link. I've found the part of the code where the bug exists:

        Code:
                    for(int i=0; i<Y.Length; i++)
                    {
                        Y[i] = Closes[1][i];
                        SY += Closes[1][i];
                    }
        I am "accessing an index with a value that is invalid since its out of range" when accessing the closing prices 119 bars ago for the other instrument. That's why I included:

        Code:
        if (CurrentBar < 120)
                        return;
        It works perfectly fine for 1 year's backtest (1/1/2012 to 11/8/2012) but it doesn't seem to fix the problem on just 1 week (11/1/2012 to 11/8/2012) of data. Do you have an idea where is the problem?

        Thanks!
        You are accessing the Closes[1] barSeries. You need to check that barSeries too. Your current check, if (CurrentBar < 120), is on barSeries0.

        Comment


          #5
          Originally posted by koganam View Post
          You are accessing the Closes[1] barSeries. You need to check that barSeries too. Your current check, if (CurrentBar < 120), is on barSeries0.
          Got it! Thank you!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by kinfxhk, 07-14-2026, 09:39 AM
          0 responses
          125 views
          0 likes
          Last Post kinfxhk
          by kinfxhk
           
          Started by kinfxhk, 07-13-2026, 10:18 AM
          0 responses
          105 views
          0 likes
          Last Post kinfxhk
          by kinfxhk
           
          Started by kinfxhk, 07-13-2026, 09:50 AM
          0 responses
          85 views
          0 likes
          Last Post kinfxhk
          by kinfxhk
           
          Started by kinfxhk, 07-13-2026, 07:21 AM
          0 responses
          105 views
          0 likes
          Last Post kinfxhk
          by kinfxhk
           
          Started by kinfxhk, 07-11-2026, 02:11 AM
          0 responses
          85 views
          0 likes
          Last Post kinfxhk
          by kinfxhk
           
          Working...
          X