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

The calculation results in unrenderable values.

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

    The calculation results in unrenderable values.

    Hi,

    Is there a way to trap this error below?

    Error on calling 'OnCalculateMinMax' method on bar 0: The calculation results in unrenderable values.

    It's thrown on an indicator and can't be caught using try catch (at least I haven't been able to). The indicator uses a number of data series and timeframes so is very difficult to track down (I've tried print statements etc....). Example of the value being set is below.

    var roundedValue = Math.Round(Values[barsInProgress][1] + currencyChange, 1);
    Values[BarsInProgress][0] = roundedValue;

    I use BarsInProgress in the Values series as earlier in the indicator I've created a number of plots using a loop.

    Thanks

    #2
    This was meant for the NT8 forums, can this post be deleted? I've reposted here:

    Comment


      #3
      Hello,

      Thank you for the post, I have moved this into the correct forum.

      I wanted to check, does the indicator throwing the error override OnCalculateMinMax?

      Generally the best way to isolate the problem is to reduce the code used by temporarly commenting parts out. Then re apply the indicator to see if the error persists, this works in most cases where you can reproduce the error at will.

      It would be hard to say what may be happening without more details on the syntax used.

      I look forward to being of further assistance.
      JesseNinjaTrader Customer Service

      Comment


        #4
        Hi Jesse,

        It doesn't override OnCalculateMinMax.

        The question is more around is it possible to catch this error anywhere or is it thrown outside of the Ninjascript object? Can catch other errors but this wasn't doesn't seem to be thrown within the indicator. Aim would be to catch this error so could find further details of what values are causing it.

        Thanks

        Comment


          #5
          Hello,

          The error is just generally telling us that some value was not valid in that method, unfortunately the error is not specific enough to provide direct instruction on a correction without further locating the cause first.

          This could be coming from something that the indicator uses such as a DrawingTool or another indicator, it could also potentially be some syntax in the indicator creating a value that causes the error.

          Without knowing what syntax was used I couldn't suggest a specific approach to prevent the exception. I would suggest to reduce the code in the indicator to locate some region of syntax that controls if this error shows up or not. we could look at that region of code specifically or you could excerpt that code into a smaller sample for testing. With that information we could see why that syntax is causing the error and if it would be expected.


          I look forward to being of further assistance.
          JesseNinjaTrader Customer Service

          Comment


            #6
            I fixed this issue in a case when i had it

            Hi !

            Totally late, and douglas as probably fixed is issue, i just wanted to share, in case anyone else had the same issue (same error code anyway), that i had the issue, and the way i fixed it :

            Super simple, if you take your calculator and divide a number by 0 (like 10/0), you will likely get an error.

            The way i had the issue, is that i used dynamic values for a division, yet, from time to time, the value used to divide, will get to 0, while its updating, and so, for just a fraction of a moment, we would do the 10/0, then crash everything.
            In my case, it happen only on realtime, and not often (15 to 30 minutes for the issue to appear).

            So, the totally simple way to fix the issue (the issue that i had with the error code discussed in this thread anyway), is to do this :

            Code:
            if (MyDivider > 0)
            {//To avoid RealTime issues, when the max-min would change and be equal to 0 for a moment, we would try to divide a number by 0, which would cause an unrenderable value
            MyGreatValue = (MyInputToDivide / MyDivider);
            }
            Maybe it can help somebody ! Have a great day !

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by sidlercom80, 10-28-2023, 08:49 AM
            166 responses
            2,233 views
            0 likes
            Last Post sidlercom80  
            Started by thread, Yesterday, 11:58 PM
            0 responses
            1 view
            0 likes
            Last Post thread
            by thread
             
            Started by jclose, Yesterday, 09:37 PM
            0 responses
            6 views
            0 likes
            Last Post jclose
            by jclose
             
            Started by WeyldFalcon, 08-07-2020, 06:13 AM
            10 responses
            1,414 views
            0 likes
            Last Post Traderontheroad  
            Started by firefoxforum12, Yesterday, 08:53 PM
            0 responses
            11 views
            0 likes
            Last Post firefoxforum12  
            Working...
            X