Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SampleGetBar

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

    SampleGetBar

    Hi,

    I am trying to use the SampleGetBar provided by NinjaTrader as is but I am getting the following error.

    "Error on calling 'OnBarUpdate' method for indicator 'SampleGetBar' on bar 4743: 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."

    I have tried if (CurrentBar < 2) return; to no avail.

    I have attached a copy for you to look at, cheers.
    Attached Files

    #2
    Hello suprsnipes,

    Thank you for your post.
    • Are you loading the SampleGetBar on a chart or Market Analyzer?
    • How many days are set to load for a chart? You can check this by right clicking in you chart > select Data Series > then check the 'Days to load' setting.
    • What instrument are your testing the SampleGetBar on?
    • What interval is your chart set to? Example: Minute, Tick, Day, etc.
    • Have you modified the SampleGetBar? Is it any different from the file you have attached to this thread?

    I look forward to assisting you further.

    Comment


      #3
      Originally posted by suprsnipes View Post
      Hi,

      I am trying to use the SampleGetBar provided by NinjaTrader as is but I am getting the following error.

      "Error on calling 'OnBarUpdate' method for indicator 'SampleGetBar' on bar 4743: 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."

      I have tried if (CurrentBar < 2) return; to no avail.

      I have attached a copy for you to look at, cheers.
      From where did you obtain this code? I do not see it listed in my installation. Are you sure that it is provided by NinjaTrader? It does not even have their copyright in there.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      559 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      324 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
      546 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