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

printing in drawtext

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

    printing in drawtext

    I need to print a result as a decimal with two spaces to the right: ".22" for example. Like a percentage. What is the correct format?

    Thank you.

    #2
    Hello imalil,

    Thank you for your note.

    To print a value of a variable with two decimals to the right you could use,

    Print(yourVariable.ToString("#.##"));

    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Thanks, let me clarify: I need to print it on my chart using Draw.Text. What is the correct format to print an integer, or any length of decimal? I've never been told the correct format.

      Thank you.

      Comment


        #4
        This should be in the NT8 forum. Sorry about that.

        Comment


          #5
          Hello imalil,

          I have attached two indicators, 1 for NT7 and 1 for NT8, which will print the last bars close to the top of the chart with 3 decimals.

          For 5 decimals rather than 3, you would change,

          closeToChart.ToString("0.000"),

          To,

          closeToChart.ToString("0.00000"),

          If you want all decimals, if available, use the pound symbol,

          (closeToChart.ToString("0.########"),

          Please see ToString format,


          Please let us know if you need further assistance.
          Attached Files
          Alan P.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by pibrew, Today, 06:37 AM
          0 responses
          0 views
          0 likes
          Last Post pibrew
          by pibrew
           
          Started by rbeckmann05, Yesterday, 06:48 PM
          1 response
          12 views
          0 likes
          Last Post bltdavid  
          Started by llanqui, Today, 03:53 AM
          0 responses
          6 views
          0 likes
          Last Post llanqui
          by llanqui
           
          Started by burtoninlondon, Today, 12:38 AM
          0 responses
          10 views
          0 likes
          Last Post burtoninlondon  
          Started by AaronKoRn, Yesterday, 09:49 PM
          0 responses
          15 views
          0 likes
          Last Post AaronKoRn  
          Working...
          X