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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      579 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      334 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      554 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      551 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X