NexusFi: Find Your Edge


Home Menu

 





Bond price markers for Indys/Analyzer etc


Discussion in NinjaTrader

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




 
Search this Thread

Bond price markers for Indys/Analyzer etc

  #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?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
REcommedations for programming help
Sierra Chart
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
MC PL editor upgrade
MultiCharts
Better Renko Gaps
The Elite Circle
 
  #2 (permalink)
 traderwerks   is a Vendor
 
Posts: 692 since Jun 2009
Thanks Given: 436
Thanks Received: 465

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


© 2024 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 - Privacy Policy - Downloads - Top
no new posts