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 cmtjoancolmenero, Yesterday, 03:58 PM
          9 responses
          35 views
          0 likes
          Last Post cmtjoancolmenero  
          Started by DayTradingDEMON, Today, 09:28 AM
          4 responses
          21 views
          0 likes
          Last Post DayTradingDEMON  
          Started by geddyisodin, Yesterday, 05:20 AM
          9 responses
          50 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by George21, Today, 10:07 AM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_ChristopherJ  
          Started by Stanfillirenfro, Today, 07:23 AM
          9 responses
          24 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X