Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 pmachiraju, 11-01-2023, 04:46 AM
      8 responses
      147 views
      0 likes
      Last Post rehmans
      by rehmans
       
      Started by mattbsea, Today, 05:44 PM
      0 responses
      5 views
      0 likes
      Last Post mattbsea  
      Started by RideMe, 04-07-2024, 04:54 PM
      6 responses
      33 views
      0 likes
      Last Post RideMe
      by RideMe
       
      Started by tkaboris, Today, 05:13 PM
      0 responses
      5 views
      0 likes
      Last Post tkaboris  
      Started by GussJ, 03-04-2020, 03:11 PM
      16 responses
      3,282 views
      0 likes
      Last Post Leafcutter  
      Working...
      X