Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Overflow Error

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

    Overflow Error

    I'm getting the following error when performing log and other math calculations:

    Error on plotting indicator MyIndicator: Please the 'OnBarUpdate or the 'Plot' method: Overflow error.

    What could cause this to happen? I am plotting pre-values nicely but suddenly I get this error after adding a Math.Log(myval) to the data to be output.

    Thanks.

    #2
    Additional info

    It seems I'm getting those errors when performing a Math.Log call on my data, for example:

    double logged = Math.Log(myVar);
    mySeries.Set(logged);

    Prior in my code I am also performing various log operations and have observed strange behavior. I am only passing it absolute data and I am observing negative values in the logged data when plotting it. That should be impossible, correct? When handing a set of positive vars to a Math.Log function it should only produce positive numbers.

    Any input/help welcome.

    Comment


      #3
      molecool,

      Have you tried this on a very very simple indicator with only those two lines? What is the value of myVar?
      Josh P.NinjaTrader Customer Service

      Comment


        #4
        Originally posted by NinjaTrader_Josh View Post
        molecool,

        Have you tried this on a very very simple indicator with only those two lines? What is the value of myVar?
        No, I haven't - the issue here is that the log function works fine the first two or three times. But as you add more Math.Log operations at some point things start breaking. I am not sure as to why this is happening - perhaps it's some internal pointer problem, who knows.

        I'm sure however that it would work fine in a simple script. But in general - math operations like this should not break no matter what.

        BTW, the value of myVar is just a double below 10.0.

        Comment


          #5
          >> math operations like this should not break no matter what.
          Huh? Please consult the MS docs to understand that you e.g. can't create the Log() of a negative value.

          Comment


            #6
            Originally posted by NinjaTrader_Dierk View Post
            >> math operations like this should not break no matter what.
            Huh? Please consult the MS docs to understand that you e.g. can't create the Log() of a negative value.
            Yes, of course I am actually testing for that - I'm not a complete noob. The strategy I'm migrating has successfully run for over a year in ThinkOrSwim. Checking for negatives is kind of essential when performing log operations.

            myVal > 0 ? Math.Log(myVal) : 0;

            You know - if you're treating me like a noob I might as well not bother help you test your beta. I used to write software for 20 years before I retired and started trading - used to be director of technology for two companies and I am currently CTO at a firm I started. So, you might not want to jump to conclusions unless it's clearly established that I don't know what I'm talking about.

            Comment


              #7
              molecool,

              Please provide an as simple as possible reference we can use that highlights your issue. Thank you.
              Josh P.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              599 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              344 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              103 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              558 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              557 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X