Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Drawing a text anywhere on the chart

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

    Drawing a text anywhere on the chart

    Hello,
    i want to draw a text anywhere on the chart.
    No DrawFixedText please.
    Any examples better than these from the DrawText would be very appreciated.

    #2
    mate41, the supported calls for this programmatic text placement would be DrawText and the DrawTextFixed you already know.



    The generalized DrawText would allow for more flexible text placement than the DrawTextFixed which would use predefined locations.

    Comment


      #3
      Thanks Bertrand,
      but can't get DrawText() working. Nor that example. I've no problem with DrawTextFixed but that's not what i want.

      Comment


        #4
        mate41,

        If you would like feedback on any code you're trying to use, please post here so we can take a look.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Bertrand,
          attached the code. I want to replace the DrawTextFixed() with DrawText() so it can be placed anywhere on the chart.
          Attached Files

          Comment


            #6
            DrawText requires that you specify the X,Y position of the text. The barsAgo parameter is used for the X position, and then whatever price you specify for the Y value. You can use bar objects like High[0] or Low[0] for the Y value.

            Please see here for the method signatures available. You can also specify DateTime for the x if you want.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Sorry,
              cant get this DrawText working
              DrawText("change_Net", false, change_Net.ToString("F"), 10, High[10] + 1 * TickSize, 0, Color.Red, textFont1, StringAlignment.Center, Color.Black, Color.Yellow, 10);
              Like this in my TopRight corner
              Attached Files
              Last edited by mate41; 11-02-2011, 03:34 AM.

              Comment


                #8
                mate41, sorry but I still do not follow you - why are you not working with the DrawTextFixed if you wish to draw to the TopRight corner?

                To access the chart's x / y values directly for free placement you would need to work with the unsupported ChartControl methods.

                Comment


                  #9
                  Hello Bertrand,
                  a little clearer; the attached screenshot of my topright corner is what i want anywhere on my chart; not on any corner or center. I programmed that indication with DrawTexFixed because my DrawText won't work.

                  Comment


                    #10
                    Thanks for the clarification, this would not unfortunately not work with either supported method as you would need to know the chart's scale boundaries to 'anchor' this text box at your desired locations then. The unsupported ChartControl would offer this, but that's an undocumented territory you would need to check out on your own (there are some threads as well here on the forums where users exchange ideas around this area).

                    Comment


                      #11
                      Thanks Bertrand,
                      maybe it could make more sense removing that function from the guide if it can't work.( at least his extension)

                      Comment


                        #12
                        The function works exactly as designed and documented in this link - http://www.ninjatrader.com/support/h...7/drawtext.htm

                        It will draw the text on the bar and double price value specified - what you cannot use per default are the chart's x / y coordinates as we do not support methods for accessing them.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        633 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        364 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by Mindset, 02-09-2026, 11:44 AM
                        0 responses
                        105 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                        0 responses
                        567 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        568 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X