Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Curious 399.9999999999

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

    Curious 399.9999999999

    I'm calling two values from the stock Darvis Indicator.. Not sure what the "double.MinValue" is about....
    public class Darvis : Indicator
    {
    #region Variables
    public double boxTop = double.MinValue;
    public double boxBottom = double.MaxValue;
    --------------------------------------------------------------------------------------------------------------------------------
    The values seem to DrawText on my chart ok but when I try to display in the Output Window there is a curious 399.99999999 that seems to be appended to the value..

    My Strategy
    private double DarvisTBox = double.MinValue;
    private double DarvisBBox = double.MaxValue;

    DarvisTBox = DarvisIndicator().boxTop;
    DarvisBBox = DarvisIndicator().boxBottom;
    DrawText("MyText"+ CurrentBar, DarvisTBox.ToString(), 0, DarvisTBox, Color.Blue);
    DrawText("MyText2"+ CurrentBar, DarvisBBox.ToString(), 0, DarvisBBox , Color.Red);

    Print(Time[0]);
    //Print( DarvisBBox);
    Print(DarvisIndicator().boxBottom);

    Output window
    339.999999999989
    8/3/2010 10:44:33 AM
    762
    339.999999999989
    8/3/2010 10:46:06 AM
    762
    339.999999999989
    8/3/2010 10:46:40 AM
    762
    339.999999999989
    8/3/2010 10:47:35 AM
    1.79769313486232E+308 (looks like this shows up when there is no value)
    339.999999999989
    8/3/2010 10:48:25 AM
    1.79769313486232E+308
    Attached Files

    #2
    Hello gg80108,

    This most likely relates to double precision issue. Below is wikipedia article on this:


    It's sometimes difficult to store the precise number in a double value. Some approaches for working on this issue are covered in this post:
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Txs the Math.Abs did the trick!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      656 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      371 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      109 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      574 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      579 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X