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 Hwop38, 05-04-2026, 07:02 PM
      0 responses
      160 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      308 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      245 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      349 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      178 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X