Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error on calling 'CalculateMinMax' method on bar for a non-existent bar

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

    Error on calling 'CalculateMinMax' method on bar for a non-existent bar

    I am running into an odd issue that started occurring on an indicator that has been fine for some time.

    The odd issue is that the bar # reported is never hit because it is technically the lastBar + 1 (this is occuring within a Strategy backtest).

    So I am unable to see what calculation is occuring because any attempt at catching bar # 1364 within the debugger doesnt occur. I placed if(CurrentBar == 1364) checks for breakpoint in both the strategy and the indicator, and neither are being hit. Setting a lower number (1363), is hit.

    What is even stranger is that the error doesnt occur when first running the backtest, it occurs when moving the "Chart" backwards in time. So the indicator it is occurring on renders just fine, and as you scroll backwards it eventually disappears throwing the error.

    Hoping for some help or a clue on what to dig into to figure this out.

    #2
    Seems the NaN was occuring earlier in the indicator processing, so the Error message was just a faulty error message.

    Comment


      #3
      Hello BraisedInBlue,

      Is that the exact error message?

      Is this indicator setting a plot? Is the plot set to a valid value on each bar?

      Does this script override OnCalculateMinMax()?


      If so, print the values before they are set to the MinValue and MaxValue.
      Are these acceptable values?

      Can you provide an export of a test script with just the code causing the error and no other code and attach this with your next post?
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        The error was Error on calling 'CalculateMinMax' method on bar for Bar 1364: would result in unrenderable value. Now the back test only contained 1363 bars, and ultimately I just checked for any Nans on the indicator and prevent them from getting into the Plot's series. This fixed by issue, but the exception handler was reporting something that wasn't helpful.

        Comment

        Latest Posts

        Collapse

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