• 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);
    JoshNinjaTrader 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)
          JoshNinjaTrader 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.
              JoshNinjaTrader 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);
                  JoshNinjaTrader 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 Appause70, Today, 05:16 AM
                      0 responses
                      1 view
                      0 likes
                      Last Post Appause70  
                      Started by wolfcuring, Today, 04:08 AM
                      0 responses
                      4 views
                      0 likes
                      Last Post wolfcuring  
                      Started by cirzonorkecv, Yesterday, 11:52 PM
                      0 responses
                      7 views
                      0 likes
                      Last Post cirzonorkecv  
                      Started by rickyblah12, Yesterday, 01:01 PM
                      1 response
                      14 views
                      0 likes
                      Last Post Erwin Beckers  
                      Started by dadarara, Yesterday, 12:18 PM
                      0 responses
                      9 views
                      0 likes
                      Last Post dadarara  
                      Working...
                      X