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

Question regarding creating your own font object in NT7 script

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

  • NinjaTrader_ZacharyG
    replied
    Hello brucelevy,

    You will use the constructor that accepts FontStyle.

    https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx

    Code:
    Font(string familyName, float emSize, FontStyle style)

    Leave a comment:


  • brucelevy
    replied
    How do you add bold text with this?

    Leave a comment:


  • mbesha
    replied
    It worked! Thanks.

    Leave a comment:


  • NinjaTrader_ZacharyG
    replied
    Hello mbesha,

    Thank you for writing in.

    You will want to create a Font object.

    https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx

    As an example:
    Code:
    private Font myFont = new Font("Times New Roman", 24);
    
    protected override void OnBarUpdate()
    {
    	DrawTextFixed("Text", "Hello world!", TextPosition.BottomRight, Color.Blue, myFont, Color.Transparent, Color.Transparent, 0);
    }
    Please, let us know if we may be of further assistance.

    Leave a comment:


  • Question regarding creating your own font object in NT7 script

    How does one create their own font object in NT7 script? For NT8, for example, I know I can use the following:

    NinjaTrader.Gui.Tools.SimpleFont myFont = new NinjaTrader.Gui.Tools.SimpleFont("Courier New", 12) { Size = 50, Bold = true };

    Draw.Text(this, "myTag", false, "Hi There!", 0, Low[0], 5, Brushes.Blue, myFont, TextAlignment.Center, Brushes.Black, null, 1);

    What is the NT7 equivalent of the code for creating "myFont"? I tried using the same SimpleFont syntax but it produced an error when I tried to compile it. Please let me know. Thanks.

Latest Posts

Collapse

Topics Statistics Last Post
Started by llanqui, Yesterday, 07:50 AM
4 responses
28 views
0 likes
Last Post llanqui
by llanqui
 
Started by vapala, Yesterday, 06:22 AM
3 responses
27 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by neo302, 11-25-2022, 03:33 PM
4 responses
44 views
0 likes
Last Post neo302
by neo302
 
Started by crystalet, Today, 06:59 AM
0 responses
1 view
0 likes
Last Post crystalet  
Started by Bidder, Today, 06:47 AM
0 responses
6 views
0 likes
Last Post Bidder
by Bidder
 
Working...
X