• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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 Bricolico, Yesterday, 09:28 PM
                      1 response
                      6 views
                      0 likes
                      Last Post NinjaTrader_PaulH  
                      Started by aworldnervelink, Today, 06:43 AM
                      0 responses
                      5 views
                      0 likes
                      Last Post aworldnervelink  
                      Started by Irukandji, Today, 06:24 AM
                      0 responses
                      11 views
                      0 likes
                      Last Post Irukandji  
                      Started by corman, 04-11-2020, 03:14 AM
                      4 responses
                      46 views
                      0 likes
                      Last Post trader333  
                      Started by BGWTEX, Today, 06:08 AM
                      0 responses
                      7 views
                      0 likes
                      Last Post BGWTEX
                      by BGWTEX
                       
                      Working...
                      X