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

Font Family for Font()

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

    Font Family for Font()

    Is there a way to load the font Family in the indicator that the user pick what type of font they want?

    #2
    Hello ballboy11,

    Thanks for opening the thread.

    Yes, you can create a SimpleFont parameter in NinjaTrader 8 and then the user can select the components used to create the font.

    Code:
    if (State == State.SetDefaults)
    {
    	UserFont					= new NinjaTrader.Gui.Tools.SimpleFont("Courier New", 12) { Size = 50, Bold = true };
    }
    Code:
    [NinjaScriptProperty]
    [Display(Name="UserFont", Order=1, GroupName="Parameters")]
    public SimpleFont UserFont
    { get; set; }


    Please let me know if I may be of further assistance.
    JimNinjaTrader Customer Service

    Comment


      #3
      Unfortunately this is very limited compared to NT7. How to access underlined, strikeout, condensed, etc? NT8 won't even allow an Arial Narrow selection, a critical font for saving horizontal space.
      Attached Files
      Last edited by eDanny; 09-12-2017, 12:45 PM.
      eDanny
      NinjaTrader Ecosystem Vendor - Integrity Traders

      Comment


        #4
        Hello eDanny,

        Thanks for your feedback.

        We have a feature request tracking interest to expand the SimpleFont Class. I will submit your feedback to this request so we can track your interest as well.

        The ticket ID for the feature request is SFT-1135 and will be noted in the Release Notes page upon implementation. Release Notes can be found here: https://ninjatrader.com/support/help...ease_notes.htm

        If there is anything I can else to do to assist in the meantime, please let me know.
        JimNinjaTrader Customer Service

        Comment


          #5
          Is there a way to do this for NT7?

          Comment


            #6
            Hello ballboy11,

            Sorry for any confusion.

            You can make a Font parameter for NinjaTrader 7 as follows:

            [Description("")]
            [GridCategory("Parameters")]
            public Font MyInput0
            { get; set; }
            This will create a Font selector window when you edit the property as eDanny has shared in his post.
            JimNinjaTrader Customer Service

            Comment


              #7
              Thank you

              Thank you but I still have 1 issue. I did get it to work but when initializing the indicator the MyInput0 is always set to (none);

              private Font nMyInput0 = new Font("Arial",12,FontStyle.Bold );
              [Description("Font Name")]
              [GridCategory("Font Parameters")]
              public Font MyInput0
              { get; set; }

              How do I get it initialized?

              Comment


                #8
                I changed this got rid of the n in front and it shows,BUT now I created a template and my Indicator will not load with the object. I have to manually load the indicator.
                For some reason the template will not accept it if saved.

                private Font MyInput0 = new Font("Arial",12,FontStyle.Bold );
                [Description("Font Name")]
                [GridCategory("Font Parameters")]
                public Font MyInput0
                { get; set; }

                How do I get it initialized?

                Comment


                  #9
                  Originally posted by eDanny View Post
                  Unfortunately this is very limited compared to NT7. How to access underlined, strikeout, condensed, etc? NT8 won't even allow an Arial Narrow selection, a critical font for saving horizontal space.
                  When I really need to, I just ignore the SimpleFont class and use the correct Font class for WPF: System.Windows.Media.FontFamily.

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

                  Comment


                    #10
                    Originally posted by ballboy11 View Post
                    I changed this got rid of the n in front and it shows,BUT now I created a template and my Indicator will not load with the object. I have to manually load the indicator.
                    For some reason the template will not accept it if saved.

                    private Font MyInput0 = new Font("Arial",12,FontStyle.Bold );
                    [Description("Font Name")]
                    [GridCategory("Font Parameters")]
                    public Font MyInput0
                    { get; set; }

                    How do I get it initialized?
                    Make a web search on how to properly serialize fonts. You could also use a TypeConverter. ref: https://www.google.com/search?safe=o...for+fonts+C%23

                    Comment


                      #11
                      Thanks for your helpful posts koganam.

                      @ballboy11, you may also search for previous threads in the NinjaTrader 7 forum to see if someone else has encountered this before.

                      I found a complete example with some quick googling: http://ninjatrader.com/support/forum...69&postcount=4
                      JimNinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by koganam View Post
                        When I really need to, I just ignore the SimpleFont class and use the correct Font class for WPF: System.Windows.Media.FontFamily.

                        ref: https://msdn.microsoft.com/en-us/library/system.windows.media.fontfamily(v=vs.110).aspx
                        Maybe that is why they are called "Simple"?
                        eDanny
                        NinjaTrader Ecosystem Vendor - Integrity Traders

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Christopher_R, Today, 12:29 AM
                        0 responses
                        10 views
                        0 likes
                        Last Post Christopher_R  
                        Started by sidlercom80, 10-28-2023, 08:49 AM
                        166 responses
                        2,235 views
                        0 likes
                        Last Post sidlercom80  
                        Started by thread, Yesterday, 11:58 PM
                        0 responses
                        3 views
                        0 likes
                        Last Post thread
                        by thread
                         
                        Started by jclose, Yesterday, 09:37 PM
                        0 responses
                        8 views
                        0 likes
                        Last Post jclose
                        by jclose
                         
                        Started by WeyldFalcon, 08-07-2020, 06:13 AM
                        10 responses
                        1,415 views
                        0 likes
                        Last Post Traderontheroad  
                        Working...
                        X