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 tsantospinto, 04-12-2024, 07:04 PM
      7 responses
      126 views
      0 likes
      Last Post aligator  
      Started by futtrader, 04-21-2024, 01:50 AM
      5 responses
      56 views
      0 likes
      Last Post NinjaTrader_Eduardo  
      Started by PeakTry, Today, 10:49 AM
      0 responses
      2 views
      0 likes
      Last Post PeakTry
      by PeakTry
       
      Started by llanqui, Today, 10:32 AM
      0 responses
      5 views
      0 likes
      Last Post llanqui
      by llanqui
       
      Started by StockTrader88, 03-06-2021, 08:58 AM
      45 responses
      3,994 views
      3 likes
      Last Post johntraderuser2  
      Working...
      X