Announcement

Collapse
No announcement yet.

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 Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          574 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          333 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
          553 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          551 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X