Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help on: Error on calling 'CalculateMinMax' method on bar 7088, unrenderable values.

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

    Help on: Error on calling 'CalculateMinMax' method on bar 7088, unrenderable values.

    Hello all,

    I have programmed a derivate of an RVI indicator. See attachment. It does run on many instruments Like the EURUSD but sometimes like the ES it generates the error message

    "Error on calling 'CalculateMinMax' method on bar 7088: The calculation results in unrenderable values."

    When I print the values its ok until it prints NaN (not a number)? I think I'm missing something but can't get right.
    Could somebody have a look at the code and maybe provide a hint?

    PS this happens when +1 year of ie. 15min data is loaded into the chart or strategy analyser.

    Thanks


    Attached Files
    Last edited by fernlicht; 04-27-2021, 04:59 AM.

    #2
    Hello fernlicht,

    Thanks for your post.

    In your first line of code you have (Close[0] - Open[0]) / (High[0] - Low[0]) and you may want to protect against a divide by zero possibility. by checking the High[0] - Low[0] is greater than zero. Something like:

    if (High[0] - Low[0] == 0) // check for potential divide by zero
    {
    Avg[0] = Avg[1]; // use the previous value of Avg if high-low = zero
    }
    else
    {
    Avg[0] = (Close[0] - Open[0]) / (High[0] - Low[0]);
    }

    Also, your first line is assigned to AVG[0], did you mean to use your data series RViRaw[0] for the first line?

    Comment


      #3
      Thanks Paul, division by zero did the trick. basic math could not see the tree in the wood.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      80 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      63 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      63 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      54 views
      0 likes
      Last Post CarlTrading  
      Working...
      X