Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Font size in Draw methods

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

    Font size in Draw methods

    Is there any way to set the font size in the DrawText and DrawTextFixed methods? I The HelpGuide only lists type of font as a parameter.

    #2
    Yes, you could setup a custom font including size and then use it in the overload -

    private Font myFont = new Font("Arial", 10);

    Comment


      #3
      Thank you, Bertrand. Previous to adding color and font, my DrawTextFixed statement had compiled and worked fine. When I added color or both, I got "No overload for method 'DrawTextFixed' takes '4' arguments" Then the message with '5' arguments. Here is the statement.
      DrawTextFixed("yesterClose",dtPrevTradeDate.ToString("dddd") + "'s close was "+ Convert.ToString(yesterClose),TextPosition.TopRigh t,Color.Green,new Font("Arial",18));

      Note: Right is shown with a space between the h and t in my browser but that's not the case in my code.
      Last edited by sgordet; 01-01-2011, 01:49 PM.

      Comment


        #4
        If you take the advanced overload with more options, you need to define outline color, area color and opacity as well, would the below compile for you?

        DrawTextFixed("yesterClose", dtPrevTradeDate.ToString("dddd") + "'s close was "+ Convert.ToString(yesterClose), TextPosition.TopRight, Color.Green, new Font("Arial",18), Color.Blue, Color.DarkGray, 5);

        Comment


          #5
          Worked perfectly!. Thanks for going the extra step and including sample code. Much appreciated.

          Comment


            #6
            Bertrand,

            I tried a variation of your suggestion:in variables I included
            private Font myFont = new Font("Arial Bold", 12);

            and then in my code I have:
            DrawText(CurrentBar.ToString(), "xMA1", 0, High[0] + 5 * TickSize * vTickMult, Color.Black, new Font("Arial Bold", 12) );

            but I get 'no overload for drawtext takes 6 arguments' ... this does draw correctly if I dont have the last 'new Font("Arial Bold"), 12) included !

            What did I miss?

            Thanks,
            Jon

            Comment


              #7
              Hi jon,

              You'll have to use one of the DrawText overloads that supports specifying a font.
              Please see the following link for supported overloads:
              Ryan M.NinjaTrader Customer Service

              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