Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicators plotting wrong values on ZB

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

    Indicators plotting wrong values on ZB

    Hi,
    I have noticed this weird problem with ZB, possible bug maybe in reading tick size,
    when I load indicators to the chart, I get wrong values plotted. (see attached screenshot)
    The value should have been somewhere between 137.00 to 137.01,
    Instead its showing a value of 137.02, which is wrong.
    Is this a known issue? how can this be fixed ?

    Thanks in advance,

    best regards

    Noam Barel
    Attached Files
    Last edited by NoamBarel; 09-23-2014, 06:02 AM.

    #2
    Hello Noam,

    Unfortunately this is as expected. Indicators reports decimal values while ZB price bars use fractional prices. The same applies for the ZN and ZF.

    There is no setting in NinjaTrader available that will plot indicator values in fractional prices.
    JasonNinjaTrader Customer Service

    Comment


      #3
      Hi Jason,
      Thanks for your quick replay.

      So no solution in this case?

      Comment


        #4
        Unfortunately I am not aware of a way to have indicators plot fractional prices for futures such as ZB and ZN.

        You could calculate the fractional price manually - divide the decimal value by 0.03125.
        JasonNinjaTrader Customer Service

        Comment


          #5
          Well, actually that's a great solution.. I can manually code it.

          Thanks alot Jason !

          Comment


            #6
            You can use the following code and insert it after the properties region.


            Code:
            #region Miscellaneous
            
            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;
            }        
            #endregion
            Your indicators should now work properly with bond futures, see chart below.
            Attached Files

            Comment


              #7
              Originally posted by NinjaTrader_Jason View Post
              Unfortunately I am not aware of a way to have indicators plot fractional prices for futures such as ZB and ZN.

              You could calculate the fractional price manually - divide the decimal value by 0.03125.
              The SessionPivots indicators in the download section also plot fractional prices for interest rate futures.

              Attached Files
              Last edited by Harry; 09-27-2014, 04:27 AM.

              Comment


                #8
                Thanks Harry !

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by judysamnt7, 03-13-2023, 09:11 AM
                4 responses
                59 views
                0 likes
                Last Post DynamicTest  
                Started by ScottWalsh, Today, 06:52 PM
                4 responses
                36 views
                0 likes
                Last Post ScottWalsh  
                Started by olisav57, Today, 07:39 PM
                0 responses
                7 views
                0 likes
                Last Post olisav57  
                Started by trilliantrader, Today, 03:01 PM
                2 responses
                21 views
                0 likes
                Last Post helpwanted  
                Started by cre8able, Today, 07:24 PM
                0 responses
                10 views
                0 likes
                Last Post cre8able  
                Working...
                X