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

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 zstheorist, Today, 07:52 PM
          0 responses
          7 views
          0 likes
          Last Post zstheorist  
          Started by pmachiraju, 11-01-2023, 04:46 AM
          8 responses
          150 views
          0 likes
          Last Post rehmans
          by rehmans
           
          Started by mattbsea, Today, 05:44 PM
          0 responses
          6 views
          0 likes
          Last Post mattbsea  
          Started by RideMe, 04-07-2024, 04:54 PM
          6 responses
          33 views
          0 likes
          Last Post RideMe
          by RideMe
           
          Started by tkaboris, Today, 05:13 PM
          0 responses
          6 views
          0 likes
          Last Post tkaboris  
          Working...
          X