• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Get significant digits for instrument

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

    Get significant digits for instrument

    Hello.

    Can anybody tell my, how i can get significant digits for instrument? I am need it for writing to file.

    #2
    Hello Dzammer,

    I've done a quick google search for significant digits string c# and found the following links:
    http://stackoverflow.com/questions/3...ficant-figures

    https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx

    https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello Dzammer,

      I've done a quick google search for significant digits string c# and found the following links:
      http://stackoverflow.com/questions/3...ficant-figures

      https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx

      https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx
      Ninja have not standart function to get digits of instrument? I have reading this examples and all have problem. When convert 1.2351 to string, we can get 1.23519999999. That numbers have different digit numbers. Do you have other issue?

      Comment


        #4
        Hello,

        No, NinjaTrader does not have a function to to set the number of digits in a string as this is already part of C#.
        (NinjaScript is written in C#. Any existing C# functions are not going to be re-created)

        Are you finding that using the correct Number format string is not working for you?

        What is the output you are getting?
        What is the output you are wanting?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ChelseaB View Post
          Hello,

          No, NinjaTrader does not have a function to to set the number of digits in a string as this is already part of C#.
          (NinjaScript is written in C#. Any existing C# functions are not going to be re-created)

          Are you finding that using the correct Number format string is not working for you?

          What is the output you are getting?
          What is the output you are wanting?
          I use this:
          PHP Code:
                  private int GetInstrumentDigits()
                  {
                      
          string digits_str Instrument.MasterInstrument.TickSize.ToString();
                      return 
          digits_str.Length digits_str.IndexOf(Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator)) - 1;
                  } 
          It works write now.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by bortz, Today, 07:45 AM
          0 responses
          4 views
          0 likes
          Last Post bortz
          by bortz
           
          Started by hir04068, Today, 06:58 AM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_Jim  
          Started by aprendiz, Today, 07:25 AM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_Jim  
          Started by vivekniwas, Yesterday, 10:21 PM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by escobar63, Yesterday, 05:06 PM
          1 response
          14 views
          0 likes
          Last Post NinjaTrader_PaulH  
          Working...
          X