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 judysamnt7, 03-13-2023, 09:11 AM
          4 responses
          53 views
          0 likes
          Last Post DynamicTest  
          Started by ScottWalsh, Today, 06:52 PM
          4 responses
          33 views
          0 likes
          Last Post ScottWalsh  
          Started by olisav57, Today, 07:39 PM
          0 responses
          6 views
          0 likes
          Last Post olisav57  
          Started by trilliantrader, Today, 03:01 PM
          2 responses
          19 views
          0 likes
          Last Post helpwanted  
          Started by cre8able, Today, 07:24 PM
          0 responses
          6 views
          0 likes
          Last Post cre8able  
          Working...
          X