Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ZB (bonds) price / display format

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    ZB (bonds) price / display format

    How does one go about formatting the price markers in a chart?

    The current price for the ZB displays just fine with the XXXX'ZZ representing XXXX ZZ/32.

    But whenever I have a custom indicator or stock indicator like PriorDayOHLC, it displays the price marker in decimal format.

    Thank you in advance.

    #2
    This is unfortunately expected as outcome 8DTK8 - you could setup a custom marker with DrawText converting the value though - http://www.ninjatrader.com/support/f...ead.php?t=7122

    Comment


      #3
      Please add below code in the class of your indicator. This will fix price marker issues with bond futures.

      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;
      }

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      42 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      25 views
      0 likes
      Last Post PaulMohn  
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      162 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      98 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      157 views
      2 likes
      Last Post CaptainJack  
      Working...
      X