NexusFi: Find Your Edge


Home Menu

 





NT8 Get String Size (Used to be Graphics.MeasureString in NT7)


Discussion in NinjaTrader

Updated
    1. trending_up 2,108 views
    2. thumb_up 2 thanks given
    3. group 1 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 Maza 
Cluj-Napoca Cluj/Romania
 
Experience: Intermediate
Platform: NinjaTrader, MetaTrader 4
Broker: FXCM, Continuum
Trading: Forex, Futures
Posts: 12 since Apr 2013
Thanks Given: 6
Thanks Received: 7

Hello NT8 Programmers Happy New Year,

I have been slaving over conversions from NT7 to NT8 lately and I ran into an issue that I just can't find the solution to.

Let's just get to the point. I am trying to build an arrow with text that doesn't overlap when you change the chart scale or zoom in and out (this I have figured out), but the issue now is when I try to have 2 arrows with text one above the other, and scale the chart of course. What I feel is missing is the ability to use a Grapics.MeasureString so I can get the size in pixels of the text and plot the arrow below or above what ever the case might be.

Does anyone have any idea how to "Measure String" in NT8 or something similar?

Thanks in advance,

Maza.


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Topstep Acquires The Futures Desk -- Prop Firm Consolida …
Funded Trading Evaluation Firms
The 50/50 Paradox: Peace and Invasion Each at 20% -- Ira …
Prediction Markets & Event Contracts
Iran Peace Expired NO: Ceasefire on Life Support, OPEC a …
Prediction Markets & Event Contracts
TradingView Opens Volume Footprint Data to Pine Script - …
TradingView
The Backwardation Signal: How the CL Futures Curve Tells …
Commodities
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
7 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #3 (permalink)
 
ratfink's Avatar
 ratfink 
Birmingham UK
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
Posts: 3,550 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,430



Maza View Post
Hello NT8 Programmers Happy New Year,

I have been slaving over conversions from NT7 to NT8 lately and I ran into an issue that I just can't find the solution to.

Let's just get to the point. I am trying to build an arrow with text that doesn't overlap when you change the chart scale or zoom in and out (this I have figured out), but the issue now is when I try to have 2 arrows with text one above the other, and scale the chart of course. What I feel is missing is the ability to use a Grapics.MeasureString so I can get the size in pixels of the text and plot the arrow below or above what ever the case might be.

Does anyone have any idea how to "Measure String" in NT8 or something similar?

Thanks in advance,

Maza.

I don't know NT8 or WPF but I would think you'd need to start somewhere near here:

https://msdn.microsoft.com/en-us/library/system.windows.media.formattedtext.aspx

Cheers


Travel Well
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #4 (permalink)
 Maza 
Cluj-Napoca Cluj/Romania
 
Experience: Intermediate
Platform: NinjaTrader, MetaTrader 4
Broker: FXCM, Continuum
Trading: Forex, Futures
Posts: 12 since Apr 2013
Thanks Given: 6
Thanks Received: 7


ratfink View Post
I don't know NT8 or WPF but I would think you'd need to start somewhere near here:

https://msdn.microsoft.com/en-us/library/system.windows.media.formattedtext.aspx

Cheers

Thanks for the link RatFink, I will have a detailed look at it.


Started this thread Reply With Quote
Thanked by:
  #5 (permalink)
 Maza 
Cluj-Napoca Cluj/Romania
 
Experience: Intermediate
Platform: NinjaTrader, MetaTrader 4
Broker: FXCM, Continuum
Trading: Forex, Futures
Posts: 12 since Apr 2013
Thanks Given: 6
Thanks Received: 7

Ok so I solved the issue, kind of, and I will write it here if anyone else wants to do this sort of thing in the future.

First of all I got the price from arrow1 and I changed it to pixels, then I added a few pixels and the custom auto pixeling bit of code that accounts for the scaling of the arrows and, to my surprise that it worked, I added the size of the font to the arrow1 pixels, then transformed it all back to price and set arrow2 price to the newly calculated price.

I hope this helps anyone that comes across the same problem in the future.

Maza.


Started this thread Reply With Quote




Last Updated on January 15, 2016


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts