• 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

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 jecoyeko, Today, 12:45 AM
                        0 responses
                        4 views
                        0 likes
                        Last Post jecoyeko  
                        Started by Newtrader101, Yesterday, 06:31 PM
                        1 response
                        9 views
                        0 likes
                        Last Post NinjaTrader_EricB  
                        Started by Tyler7498, Yesterday, 07:34 PM
                        0 responses
                        4 views
                        0 likes
                        Last Post Tyler7498  
                        Started by Woomera, Yesterday, 07:24 PM
                        2 responses
                        10 views
                        0 likes
                        Last Post Woomera
                        by Woomera
                         
                        Started by Newtrader101, Yesterday, 12:31 PM
                        3 responses
                        16 views
                        0 likes
                        Last Post NinjaTrader_EricB  
                        Working...
                        X