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

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?

    Paul H.NinjaTrader Customer Service

    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 MGHORBEL, Today, 02:28 AM
      0 responses
      4 views
      0 likes
      Last Post MGHORBEL  
      Started by dcriador, Today, 01:43 AM
      1 response
      7 views
      0 likes
      Last Post dcriador  
      Started by louiseruch, Today, 01:11 AM
      0 responses
      1 view
      0 likes
      Last Post louiseruch  
      Started by kujista, Today, 12:39 AM
      0 responses
      6 views
      0 likes
      Last Post kujista
      by kujista
       
      Started by tonynt, 05-21-2019, 06:27 AM
      11 responses
      536 views
      1 like
      Last Post NinjaTrader_Jason  
      Working...
      X