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

Someone give me a formula

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

    #16
    Dude. Where have you been for the past 9 months??

    That does look at lot easier than what I had to figure out the 'decimals' variable. I didn't even know that Round2TickSize() method existed! Thanks, buddy!
    cassb
    NinjaTrader Ecosystem Vendor - Logical Forex

    Comment


      #17
      Giving back

      Well people like Ralph and many others have helped me along the path to enlightenment - otherwise known as C# - glad it helped.
      I pondered about posting my solution as I thought it can't be that simple

      Comment


        #18
        Not so simple

        Maybe someone else ( eg Nt?)could provide an answer to this

        if I Print(Close[0]) on forex futures eg 6E and the price is 1.350
        the output is 1.35 - no trailing zero.
        Is there anyway to 'restore' the trailing zero as I use a substring function to knock off the first 3 or 4 digits and it is just so irritating to have to consciously think ,no, 35 is actually 350. I know I know it''s picky.

        This doesn't happen on other futures it appears.
        Last edited by Mindset; 04-08-2010, 11:50 AM. Reason: added clarification of instrument

        Comment


          #19
          Have you tried already those formatting options for #'s?

          BertrandNinjaTrader Customer Service

          Comment


            #20
            Mindset, using String formatting will work but would be specific to an instrument. I place this outside of OnBarUpdate() usually just before Properties and use this in all my indicators.

            private string FormatPrice(double iVal)
            {
            return Bars.Instrument.MasterInstrument.FormatPrice(iVal) ;
            }

            Then a print statement like this will always work:

            Print(FormatPrice(Close[0]))
            eDanny
            NinjaTrader Ecosystem Vendor - Integrity Traders

            Comment


              #21
              FormatPrice

              Appreciate that eDanny.
              I had RoundPrice but this does the trick very well.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by helpwanted, Today, 03:06 AM
              1 response
              14 views
              0 likes
              Last Post sarafuenonly123  
              Started by Brevo, Today, 01:45 AM
              0 responses
              11 views
              0 likes
              Last Post Brevo
              by Brevo
               
              Started by aussugardefender, Today, 01:07 AM
              0 responses
              6 views
              0 likes
              Last Post aussugardefender  
              Started by pvincent, 06-23-2022, 12:53 PM
              14 responses
              244 views
              0 likes
              Last Post Nyman
              by Nyman
               
              Started by TraderG23, 12-08-2023, 07:56 AM
              9 responses
              387 views
              1 like
              Last Post Gavini
              by Gavini
               
              Working...
              X