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

DrawText

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

    DrawText

    Hello, I would like to add a text field to print the current value of a custom indicator just below the name. I have added some moving averages and all the price labels on the Y axis overlap, so I would rather print these in the top left corner.

    Does anyone have a sample as to how to do this? I would like to print it just below the name of the indicator or to the right of it, which ever is easier.

    Thanks!

    #2
    tradinginzen,

    Please try DrawTextFixed(). http://www.ninjatrader-support.com/H...TextFixed.html

    DrawTextFixed("tag1", "Text to draw", TextPosition.TopLeft);
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks that worked perfectly.

      Comment


        #4
        Hello,
        How would I add to the DrawTextFixed code below to change the color of the text...right now the text color is black. Lets say I would like the text to be red or blue?

        Thanks

        Comment


          #5
          DrawTextFixed(string tag, string text, TextPosition textPosition, Color textColor, Font font, Color outlineColor, Color backColor, int opacity)
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Thanks Josh,
            This wont work.
            DrawTextFixed("CCi","RisingCCI",TextPosition.BottomRight,Color.Green);
            Do I need to add all the other things too? the...Font font, Color outlineColor, Color backColor, int opacity).

            Thanks

            Comment


              #7
              You need all.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Is there a snippet of code somewhere showing an actual syntax for
                ,Font font, entry

                Comment


                  #9
                  DrawTextFixed("tag", "text", TextPosition.Center, Color.Black, new Font("Arial", 10), Color.Black, Color.Black, 5);
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    How can you place more than one drawtext in the top left corner without overlap?

                    Comment


                      #11
                      Hello brucelevy,

                      Thanks for your post.

                      The DrawTextFixed would draw to the location specified, subsequent calls would draw to the same location, starting at the same point and so would overlay.

                      If you need multiple lines, you can use the "\n" new line command in the text.
                      Here is an example of 4 lines drawn one at a time:

                      if (CurrentBar == 0)
                      {
                      string v1 = "Line 1";
                      string v2 = "\nLine 2";
                      string v3 = "\n\nLine 3";
                      string v4 = "\n\n\nLine 4";

                      DrawTextFixed("line1",v1,TextPosition.TopLeft);
                      DrawTextFixed("line2",v2,TextPosition.TopLeft);
                      DrawTextFixed("line3",v3,TextPosition.TopLeft);
                      DrawTextFixed("line4",v4,TextPosition.TopLeft);
                      }

                      The output on the chart would be in the upper left corner:
                      Line 1
                      Line 2
                      Line 3
                      Line 4
                      Paul H.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by xiinteractive, 04-09-2024, 08:08 AM
                      5 responses
                      13 views
                      0 likes
                      Last Post NinjaTrader_Erick  
                      Started by swestendorf, Today, 11:14 AM
                      2 responses
                      5 views
                      0 likes
                      Last Post NinjaTrader_Kimberly  
                      Started by Mupulen, Today, 11:26 AM
                      0 responses
                      2 views
                      0 likes
                      Last Post Mupulen
                      by Mupulen
                       
                      Started by Sparkyboy, Today, 10:57 AM
                      1 response
                      6 views
                      0 likes
                      Last Post NinjaTrader_Jesse  
                      Started by TheMarlin801, 10-13-2020, 01:40 AM
                      21 responses
                      3,918 views
                      0 likes
                      Last Post Bidder
                      by Bidder
                       
                      Working...
                      X