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

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 thanajo, 05-04-2021, 02:11 AM
                        3 responses
                        467 views
                        0 likes
                        Last Post tradingnasdaqprueba  
                        Started by Christopher_R, Today, 12:29 AM
                        0 responses
                        10 views
                        0 likes
                        Last Post Christopher_R  
                        Started by sidlercom80, 10-28-2023, 08:49 AM
                        166 responses
                        2,236 views
                        0 likes
                        Last Post sidlercom80  
                        Started by thread, Yesterday, 11:58 PM
                        0 responses
                        4 views
                        0 likes
                        Last Post thread
                        by thread
                         
                        Started by jclose, Yesterday, 09:37 PM
                        0 responses
                        9 views
                        0 likes
                        Last Post jclose
                        by jclose
                         
                        Working...
                        X