NexusFi: Find Your Edge


Home Menu

 





Bond price markers for Indys/Analyzer etc


Discussion in NinjaTrader

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




 
Search this Thread
  #1 (permalink)
 Stocktrader 
Dublin Ireland
 
Experience: Intermediate
Platform: Ninja, TOS
Broker: RCG Direct/Continuum
Trading: ZB
Posts: 18 since Mar 2012
Thanks Given: 4
Thanks Received: 7

Apologies if this has been discussed before but I have tried a search and not found the result I was looking for.

I am tired of having to calculate 5 decimal places into a bond value (I know it can be truncated with '.ToString(".00")') when looking at indicator values or the market analyzer. eg I draw a line at today's open and the value is displayed as 128.69 instead of 128'23 (I can convert the analyzer fields in excel once they're there) .

Is there C# / NT code for converting the decimals to the right bond value? (To be displayed on a chart say the Value of an SMA. I know I will have to 'Round2TickSize')

It is done for Sierra Charts - hint **yes I'm getting fed up with minor annoyances in NT and am now looking else where** - and it is displayed correctly in the chart axis for NT - why not the indicators?


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trump Media to sell instant access to market-moving soci …
Traders Hideout
Without Pulisic, USA 61.5% Live vs. Australia -- France …
Prediction Markets & Event Contracts
Peace Deal Forward Curve: May 22%, June 51%, December 81 …
Prediction Markets & Event Contracts
Double Deadlock: Rubio Calls Hormuz Tolls "Unfeasib …
Traders Hideout
June 15 Peace Odds Surge From 3.6% to 12.25% After Trump …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
13 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks
  #2 (permalink)
 traderwerks   is a Vendor
 
Posts: 688 since Jun 2009
Thanks Given: 436
Thanks Received: 466

Try something like this. ( From Ninjatrader forum )

 
Code
public override string FormatPriceMarker(double price)
{
	double trunc = Math.Truncate(price);
	int fraction = Convert.ToInt32(320 * Math.Abs(price - trunc) - 0.0001); // rounding down for ZF and ZT
	string priceMarker = "";
	if (TickSize == 0.03125) 
	{
		fraction = fraction/10;
		if (fraction < 10)
			priceMarker = trunc.ToString() + "'0" + fraction.ToString();
		else 
			priceMarker = trunc.ToString() + "'" + fraction.ToString();
	}
	else if (TickSize == 0.015625 || TickSize == 0.0078125)
	{
		if (fraction < 10)
			priceMarker = trunc.ToString() + "'00" + fraction.ToString();
		else if (fraction < 100)
			priceMarker = trunc.ToString() + "'0" + fraction.ToString();
		else	
			priceMarker = trunc.ToString() + "'" + fraction.ToString();
	}
	else
		priceMarker = price.ToString(Gui.Globals.GetTickFormatString(TickSize));
	return priceMarker;
}


Math. A gateway drug to reality.
Reply With Quote
Thanked by:
  #3 (permalink)
 Stocktrader 
Dublin Ireland
 
Experience: Intermediate
Platform: Ninja, TOS
Broker: RCG Direct/Continuum
Trading: ZB
Posts: 18 since Mar 2012
Thanks Given: 4
Thanks Received: 7


Thanks traderwerks - now for a session of cut and paste on some indys. What else are weekends for ?


Started this thread Reply With Quote




Last Updated on September 7, 2013


© 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