Go Back   NinjaTrader Support Forum > NinjaTrader 7 > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

NinjaTrader
Reply
 
Thread Tools Display Modes
Old 09-11-2017, 12:24 PM   #1
ballboy11
Senior Member
 
Join Date: Jan 2016
Posts: 198
Thanks: 0
Thanked 5 times in 5 posts
Default 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?
ballboy11 is offline  
Reply With Quote
Old 09-11-2017, 02:09 PM   #2
NinjaTrader_Jim
NinjaTrader Customer Service
 
NinjaTrader_Jim's Avatar
 
Join Date: Nov 2016
Location: Denver, CO
Posts: 856
Thanks: 55
Thanked 208 times in 202 posts
Default

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.
NinjaTrader_Jim is offline  
Reply With Quote
Old 09-12-2017, 12:42 PM   #3
eDanny
Vendor
 
eDanny's Avatar
 
Join Date: Jul 2008
Location: East Rochester, NY
Posts: 1,211
Thanks: 15
Thanked 151 times in 124 posts
Default

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 Images
File Type: png FontPicker.png (28.9 KB, 4 views)
eDanny
NinjaTrader Ecosystem Vendor - Integrity Traders
Last edited by eDanny; 09-12-2017 at 12:45 PM.
eDanny is offline  
Reply With Quote
Old 09-12-2017, 01:17 PM   #4
NinjaTrader_Jim
NinjaTrader Customer Service
 
NinjaTrader_Jim's Avatar
 
Join Date: Nov 2016
Location: Denver, CO
Posts: 856
Thanks: 55
Thanked 208 times in 202 posts
Default

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.
NinjaTrader_Jim is offline  
Reply With Quote
Old 09-13-2017, 12:26 PM   #5
ballboy11
Senior Member
 
Join Date: Jan 2016
Posts: 198
Thanks: 0
Thanked 5 times in 5 posts
Default

Is there a way to do this for NT7?
ballboy11 is offline  
Reply With Quote
Old 09-13-2017, 01:13 PM   #6
NinjaTrader_Jim
NinjaTrader Customer Service
 
NinjaTrader_Jim's Avatar
 
Join Date: Nov 2016
Location: Denver, CO
Posts: 856
Thanks: 55
Thanked 208 times in 202 posts
Default

Hello ballboy11,

Sorry for any confusion.

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

Quote:
[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.
NinjaTrader_Jim is offline  
Reply With Quote
Old 09-13-2017, 04:52 PM   #7
ballboy11
Senior Member
 
Join Date: Jan 2016
Posts: 198
Thanks: 0
Thanked 5 times in 5 posts
Default 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?
ballboy11 is offline  
Reply With Quote
Old 09-13-2017, 04:56 PM   #8
ballboy11
Senior Member
 
Join Date: Jan 2016
Posts: 198
Thanks: 0
Thanked 5 times in 5 posts
Default

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?
ballboy11 is offline  
Reply With Quote
Old 09-13-2017, 06:39 PM   #9
koganam
Vendor
 
Join Date: Feb 2008
Posts: 7,124
Thanks: 54
Thanked 2,935 times in 2,381 posts
Default

Quote:
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
koganam
NinjaTrader Ecosystem Vendor - OmegaSigma Indicators
koganam is offline  
Reply With Quote
The following user says thank you to koganam for this post:
Old 09-13-2017, 06:47 PM   #10
koganam
Vendor
 
Join Date: Feb 2008
Posts: 7,124
Thanks: 54
Thanked 2,935 times in 2,381 posts
Default

Quote:
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
koganam
NinjaTrader Ecosystem Vendor - OmegaSigma Indicators
koganam is offline  
Reply With Quote
Old 09-14-2017, 08:23 AM   #11
NinjaTrader_Jim
NinjaTrader Customer Service
 
NinjaTrader_Jim's Avatar
 
Join Date: Nov 2016
Location: Denver, CO
Posts: 856
Thanks: 55
Thanked 208 times in 202 posts
Default

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
NinjaTrader_Jim is offline  
Reply With Quote
Old 09-14-2017, 11:42 AM   #12
eDanny
Vendor
 
eDanny's Avatar
 
Join Date: Jul 2008
Location: East Rochester, NY
Posts: 1,211
Thanks: 15
Thanked 151 times in 124 posts
Default

Quote:
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
eDanny is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Font serialization edward_bell Indicator Development 1 09-03-2014 11:27 AM
font size mballagan Platform Technical Support 3 06-12-2009 11:20 AM
Get font data yuvalw Indicator Development 2 02-14-2009 06:47 PM
New Font not working eswap0 Platform Technical Support 3 12-10-2008 02:05 PM
DrawText...Font...how do you use the font param? Can't find any examples funk101 General Development 8 05-29-2007 07:10 AM


All times are GMT -6. The time now is 06:05 PM.

Futures, foreign currency and options trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones financial security or lifestyle. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results. View Full Risk Disclosure.

CFTC Rules 4.41 - Hypothetical or Simulated performance results have certain limitations, unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, such as lack of liquidity. Simulated trading programs in general are also subject to the fact that they are designed with the benefit of hindsight. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.

This website is hosted and operated by NinjaTrader, LLC (“NT”), a software development company which owns and supports all proprietary technology relating to and including the NinjaTrader trading platform. NT is an affiliated company to NinjaTrader Brokerage (“NTB”), which is a NFA registered introducing broker (NFA #0339976) providing brokerage services to traders of futures and foreign exchange products. This website is intended for educational and informational purposes only and should not be viewed as a solicitation or recommendation of any product, service or trading strategy. No offer or solicitation to buy or sell securities, securities derivative or futures products of any kind, or any type of trading or investment advice, recommendation or strategy, is made, given, or in any manner endorsed by any NT affiliate and the information made available on this Web site is not an offer or solicitation of any kind. Specific questions related to a brokerage account should be sent to your broker directly. The content and opinions expressed on this website are those of the authors and do not necessarily reflect the official policy or position of NT or any of its affiliates. 

Vendors along with their websites, products and services, collectively referred to as (“Vendor Content”), are independent persons or companies that are in no manner affiliated with NT or any if its affiliates. NT or any of its affiliates are not responsible for, do not approve, recommend or endorse any Vendor Content referenced on this website and it’s your sole responsibility to evaluate Vendor Content. Please be aware that any performance information provided by a vendor should be considered hypothetical and must contain the disclosures required by NFA Rule 2-29(c). If you are interested in learning more about, or investigating the quality of, any such Vendor Content you must contact the vendor, provider or seller of such Vendor Content. No person employed by, or associated with, NT or any of its affiliates is authorized to provide any information about any such Vendor Content.