Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

value that is invalid since it's out of range

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

    value that is invalid since it's out of range



    Originally posted by laocoon View Post
    Hello

    I'm using the very useful Highlow indicator quite extensively and it's generally working well but at times it will freeze and produce the following error message:

    "Error on calling 'On Bar Update Method' for Indicator 'Highlow'. You are accessing an index with a value that is invalid since it's out of range, ie accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart."

    I have no idea what happens here (there are always more than 5 bars on my charts) and it would be great if this bug could be removed.

    When the indicator freezes I remove it manually and reapply it immediately. Sometimes this works and sometimes it freezes again shortly afterwards. When I reapply it a few hours later it always works fine.

    Thanks

    PS: The code is attached

    I'm experiencing the same error although I don't have the freezing issue. It's also a custom high/low indicator of sorts accessing a different timeframe. If I comment out the plot section and simply print the values, they all show in the output window but if I uncomment the plot, I get the error. Below is what I am using:

    If (CurrentBar < 1) return;
    if (CurrentBars[1] > barsrequired) {
    high = Indicator([BarsArray[1], 21).Plot0[1];
    low = Indicator([BarsArray[1], 21).Plot1[1];
    Plot0.Set(high);
    Plot1.Set(low); }

    if I substitute the plot statements for
    Print(Time[
    0] + " " + CurrentBars[1] + " high= " + high + " || low= " + low);

    The output shows:

    11/15/2010 10:32:00 AM 2 high= 1.36223 || low= 1.36223
    11/15/2010 10:32:30 AM 3 high= 1.36223 || low= 1.36223
    11/15/2010 10:33:00 AM 4 high= 1.36201 || low= 1.36201
    11/15/2010 10:33:30 AM 5 high= 1.3619 || low= 1.3619
    11/15/2010 10:34:00 AM 6 high= 1.36152 || low= 1.36152
    11/15/2010 10:34:30 AM 7 high= 1.36148 || low= 1.36148
    11/15/2010 10:35:00 AM 8 high= 1.36133 || low= 1.36133
    11/15/2010 10:35:30 AM 9 high= 1.36128 || low= 1.36128
    11/15/2010 10:36:00 AM 10 high= 1.3614 || low= 1.3614
    11/15/2010 10:36:30 AM 11 high= 1.36117 || low= 1.36117
    11/15/2010 10:37:00 AM 12 high= 1.3614 || low= 1.3614
    11/15/2010 10:37:30 AM 13 high= 1.3612 || low= 1.3612
    11/15/2010 10:38:00 AM 14 high= 1.36136 || low= 1.36136
    11/15/2010 10:38:30 AM 15 high= 1.36144 || low= 1.36144
    11/15/2010 10:39:00 AM 16 high= 1.36177 || low= 1.36177
    11/15/2010 10:39:30 AM 17 high= 1.36162 || low= 1.36162
    11/15/2010 10:40:00 AM 18 high= 1.3616 || low= 1.3616
    11/15/2010 10:40:30 AM19 high= 1.36154 || low= 1.36109
    11/15/2010 10:41:00 AM 20 high= 1.36154 || low= 1.36109
    11/15/2010 10:41:30 AM 21 high= 1.36154 || low= 1.36109

    The highs/lows will be the same until the 19th bar but the point is that values are there starting at bar 2 and I have barsrequired set at 21.

    #2
    Do you have a CurrentBars check for all added series as well and not just for the primary one?

    Comment


      #3
      I only have if (CurrentBars[1] > barsrequired) { do something; } but not a seperate check for CurrentBars[1] < 1 return; if that's what you mean. I threw the indicator together in 10 mnutes and it worked right out of the gate, until I tried to add it to another workstation the next day.

      Comment


        #4
        Yes, that what I had in mind - would you mind attaching the indicator so we could give it a run here? The BarsRequired would be visual for indicators, the unstable period we had as chart property for 6.5

        Comment


          #5
          I found the problem. I only have 1 additional bars object added to the primary chart. I was referencing CurrentBars[1] and BarsArray[1] instead of CurrentBars[0] and BarsArray[1]. I must have made last minute changes last night that broke it at some point but the inconsistency of indexes between currentbars and barsarray didn't help. Thanks anyway.
          Last edited by mgin98; 11-24-2010, 09:29 PM.

          Comment


            #6
            Thanks for reporting back and glad to hear you got it working.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            571 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            331 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
            549 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            550 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X