Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Display pips properly

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

    Display pips properly

    How can I display a number as a pip, instead of as a decimal?

    ie:

    114'270 instead of 114.843750

    Mike

    #2
    Hi Mike, unfortunately changing this is not possible.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Ok but there has to be some math that can fix this right?

      How can I do a conversion from decimal to pips?

      Mike

      Comment


        #4
        How about, decimal * 32, as in ZB in 64 half pips per point, 32 pips per point.

        .84375 * 32 = 27
        .796875 * 32 = 25.5

        Thanks for making me think about this one. I had been puzzling on it for days.
        Last edited by snaphook; 06-05-2009, 06:33 AM.

        Comment


          #5
          I don't think you can compare Forex pips to the Bonds fractional display, for Mike original issue it's just a display one, as the ' just separates the sub pip (pipette) value of the quote.
          BertrandNinjaTrader Customer Service

          Comment


            #6
            Actually,

            I am talking about the ZN instrument, wanting to be able to Print() the same value as is displayed on a chart.

            I might be confusing pips since ZN is a future not FX, my bad.

            Mike

            Comment


              #7
              Ok, thanks for clarifying - have you tried snaphook's suggestion? There are some algorithms floating around if you search google, but I'm not aware of a straightforward C# method for it.
              BertrandNinjaTrader Customer Service

              Comment


                #8
                Originally posted by ctrlbrk View Post
                How can I display a number as a pip, instead of as a decimal?

                ie:

                114'270 instead of 114.843750

                Mike
                protected override void OnBarUpdate()
                {
                Print(FormatZN(Close[0]));
                }

                private string FormatZN(double price)
                {
                return String.Format("{0}'{1:000}", Math.Truncate(price), (price - Math.Truncate(price)) * 320);
                }
                Last edited by roonius; 06-05-2009, 10:20 AM.

                Comment


                  #9
                  And depending on the number of pips in a point, the 320 (32 pips) would, for example, be changed to 500 (50 pips) or 640 (64 pips).

                  Comment


                    #10
                    Awesome thank you guys.

                    Click image for larger version

Name:	WhosAwesome.jpg
Views:	1
Size:	41.8 KB
ID:	852440

                    Mike

                    Comment


                      #11
                      How to tell code to display one way or the other?

                      In Ts you could simply use if (pricescale = ...) but how do you do that in NinjaScript, please?
                      Last edited by Mindset; 06-09-2009, 04:39 AM.

                      Comment


                        #12
                        Mindset, unfortunately I'm not aware of a method returning the pricescale, thanks for suggesting this.
                        BertrandNinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by memonolog, Today, 03:30 AM
                        0 responses
                        1 view
                        0 likes
                        Last Post memonolog  
                        Started by toughiee, Today, 12:04 AM
                        0 responses
                        3 views
                        0 likes
                        Last Post toughiee  
                        Started by vdoan20, Yesterday, 08:30 PM
                        0 responses
                        8 views
                        0 likes
                        Last Post vdoan20
                        by vdoan20
                         
                        Started by gupagoer, Yesterday, 07:42 PM
                        0 responses
                        9 views
                        0 likes
                        Last Post gupagoer  
                        Started by Holligoly, Yesterday, 05:13 PM
                        2 responses
                        11 views
                        0 likes
                        Last Post Holligoly  
                        Working...
                        X