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 charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      52 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      142 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      160 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      96 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      276 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X