NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 05-11-2008, 03:15 PM   #1
TAJTrades
Senior Member
 
Join Date: Dec 2007
Location: Atlanta
Posts: 281
Thanks: 0
Thanked 4 times in 3 posts
Default DrawText and DrawTextFixed

The links for the "The type of Font used (reference)" are broken for both DrawText and DrawTextFixed. So I went searching for some examples on the MSDN site and came up empty (my lack of knowledge).

What is the correct syntax for the Font Parameters in

DrawText(.............., Color textColor, Font font, StringAlignment .....);

Thanks.
TAJTrades is offline  
Reply With Quote
Old 05-11-2008, 05:35 PM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Something like this
private Font textFont = new Font("Arial", 12);
NinjaTrader_Josh is offline  
Reply With Quote
Old 06-18-2008, 07:36 AM   #3
fragalles
Member
 
Join Date: Aug 2007
Posts: 38
Thanks: 0
Thanked 0 times in 0 posts
Default how to use the new font variable?

if i try print something with this new Font variable i get an invalid expression term, can you complete the code segment for me:

DrawText("My text" + CurrentBar, "Hello World", 0, Low[0] -20 * TickSize, Color.Red, Font textFont);

Quote:
Originally Posted by Josh View Post
Something like this
private Font textFont = new Font("Arial", 12);
fragalles is offline  
Reply With Quote
Old 06-18-2008, 08:10 AM   #4
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

try something like
... , textFont);
NinjaTrader_Dierk is offline  
Reply With Quote
Old 12-03-2008, 09:20 AM   #5
tonyh
Member
 
Join Date: Oct 2007
Location: Florida
Posts: 94
Thanks: 0
Thanked 0 times in 0 posts
Default DrawText and DrawTextFixed Errors with Color, Font, etc.

Hello:

I have tried the suggestions in this Thread to get Color, Font, etc. to compile. However, I continually get the dreaded: "No overload for method 'DrawTextFixed' takes '4', '5', etc. arguments.

Should the line "Private Font textFont..." be in just the Variable section, or also Initialize, etc. Please advise.

Thanks. Tony.
tonyh is offline  
Reply With Quote
Old 12-03-2008, 10:05 AM   #6
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

tonyh,

Please post up everything you have. We have no idea what you have typed out right now. Thanks.
NinjaTrader_Josh is offline  
Reply With Quote
Old 12-03-2008, 10:50 AM   #7
tonyh
Member
 
Join Date: Oct 2007
Location: Florida
Posts: 94
Thanks: 0
Thanked 0 times in 0 posts
Default DrawText and DrawTextFixed

Hello Josh:

After experimenting, I found out that all options in DrawTextFixed must be included. I was leaving out things such as opacity in the statement. I had assumed one could just include the options that were desired. Thanks.
Tony.
tonyh is offline  
Reply With Quote
Old 12-19-2008, 10:21 AM   #8
tiara50
Junior Member
 
Join Date: Jun 2008
Posts: 28
Thanks: 0
Thanked 0 times in 0 posts
Default DrawText () help

I am trying to get the following example to work on my chart.

I get an error message that 10 is out of range, so I change to 0, and nothing happens.

DrawText("tag1", "Text to draw", 10, 1000, Color.Black);

Could someone please explain exactly what 10 is? and how is the Y coordinate defined? I mean is it a pixel location on the chart, or or based on price? Sorry, I just confused.

Thanks
tiara50 is offline  
Reply With Quote
Old 12-19-2008, 10:24 AM   #9
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

10 is on which bar back you want to draw on. Y-coordinate is based on price.
http://www.ninjatrader-support.com/H.../DrawText.html

If you call 10 bars back you need to ensure you have 10 bars on your chart first. Please see this tip: http://www.ninjatrader-support2.com/...ead.php?t=3170
NinjaTrader_Josh 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
DrawTextFixed() requests Lost Trader General Programming 2 04-27-2008 05:00 PM
DrawTextFixed BradB Indicator Development 4 04-18-2008 08:12 PM
DrawTextFixed not update as expected goover General Programming 2 03-04-2008 08:19 PM
DrawTextFixed rt-trader General Programming 5 01-21-2008 10:46 PM
DrawTextFixed Lost Trader General Programming 6 01-20-2008 12:32 AM


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