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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      134 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      75 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      119 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      114 views
      1 like
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      90 views
      0 likes
      Last Post CarlTrading  
      Working...
      X