Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Floating-Point Arithmetic

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

    Floating-Point Arithmetic

    Hi,
    I have a indicator output that i need to format
    TrailingStop =200,669999999999
    This should be formatted to TrailingStop =200,67

    Could somebody be so kind to show me how I do this

    Thank you very much
    Nico

    I've read this thread but this is comparing values, I just want it formatted

    #2
    What is that you want?

    - Format for visual display purposes?
    - Format to use for an order price?

    If the latter, you need not worry about this since NinjaTrader internal will take care of rounding it to a valid tick size increment. If you want to format for display, look at the ToString() method, there are options to do something like TrailStop.ToString("0.00").

    Don't quote me on the syntax but I believe that its correct.
    RayNinjaTrader Customer Service

    Comment


      #3
      Hi Ray,

      I need it formatted so I can compair this output value to previous bar close
      (Close = indicator output)
      I've looked into this thread http://www.ninjatrader-support.com/v...ead.php?t=3823
      but then later on I get an error message
      "Operator '>' cannot be applied to operands of type 'string' and double'
      Last edited by nico_p; 04-10-2008, 08:05 PM.

      Comment


        #4
        Try Math.Round(TrailingStop, 2). 2 is the parameter that determines how many decimal places you want.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by Josh View Post
          Try Math.Round(TrailingStop, 2). 2 is the parameter that determines how many decimal places you want.
          Thank you Josh
          just what I needed

          Nico

          Comment

          Latest Posts

          Collapse

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