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 XXtrader, Yesterday, 11:30 PM
          2 responses
          11 views
          0 likes
          Last Post XXtrader  
          Started by Waxavi, Today, 02:10 AM
          0 responses
          6 views
          0 likes
          Last Post Waxavi
          by Waxavi
           
          Started by TradeForge, Today, 02:09 AM
          0 responses
          11 views
          0 likes
          Last Post TradeForge  
          Started by Waxavi, Today, 02:00 AM
          0 responses
          2 views
          0 likes
          Last Post Waxavi
          by Waxavi
           
          Started by elirion, Today, 01:36 AM
          0 responses
          7 views
          0 likes
          Last Post elirion
          by elirion
           
          Working...
          X