Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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
    BertrandNinjaTrader Customer Service

    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 SantoshXX, Today, 03:09 AM
      0 responses
      6 views
      0 likes
      Last Post SantoshXX  
      Started by DanielTynera, Today, 01:14 AM
      0 responses
      2 views
      0 likes
      Last Post DanielTynera  
      Started by yertle, 04-18-2024, 08:38 AM
      9 responses
      41 views
      0 likes
      Last Post yertle
      by yertle
       
      Started by techgetgame, Yesterday, 11:42 PM
      0 responses
      12 views
      0 likes
      Last Post techgetgame  
      Started by sephichapdson, Yesterday, 11:36 PM
      0 responses
      2 views
      0 likes
      Last Post sephichapdson  
      Working...
      X