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 ageeholdings, Today, 07:43 AM
      0 responses
      7 views
      0 likes
      Last Post ageeholdings  
      Started by pibrew, Today, 06:37 AM
      0 responses
      4 views
      0 likes
      Last Post pibrew
      by pibrew
       
      Started by rbeckmann05, Yesterday, 06:48 PM
      1 response
      14 views
      0 likes
      Last Post bltdavid  
      Started by llanqui, Today, 03:53 AM
      0 responses
      6 views
      0 likes
      Last Post llanqui
      by llanqui
       
      Started by burtoninlondon, Today, 12:38 AM
      0 responses
      12 views
      0 likes
      Last Post burtoninlondon  
      Working...
      X