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

rounding to the upside

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

    rounding to the upside

    Hi,

    I know the function "this.Instrument.MasterInstrument.Round2TickSi ze" to round to the nearest valid value, however, i 'm looking for a function to call the rounding value to the uspide.

    I mean : 4.25 calls 5 and not 4

    Thx a lot for your help

    #2
    Originally posted by Thomas79 View Post
    Hi,

    I know the function "this.Instrument.MasterInstrument.Round2TickSi ze" to round to the nearest valid value, however, i 'm looking for a function to call the rounding value to the uspide.

    I mean : 4.25 calls 5 and not 4

    Thx a lot for your help
    Use a variable to capture the 4.25. Then round to tick size. now compare the two. if rounded number is less that variable, add a tick.
    RJay
    NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

    Comment


      #3
      of course !

      Thx a lot RJay

      Comment


        #4
        Hello Thomas 79,

        Thank you for your post.

        The C# function Math.Ceiling() could be used to round a number to a higher value instead of a lower value, for example, rounding 4.25 to 5 instead of 4. To accomplish this, you would save the value, say 4.25, to a variable named something like myPrice. Then you would assign myPrice = Math.Ceiling(myPrice); to round 4.25 to 5 instead of 4.

        Please see this publicly available link about Math.Ceiling() for more information - https://stackoverflow.com/questions/...earest-integer

        Let us know if we may assist further.
        Brandon H.NinjaTrader Customer Service

        Comment


          #5
          Thx BrandonH

          that's work !

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Graci117, Yesterday, 11:40 PM
          0 responses
          5 views
          0 likes
          Last Post Graci117  
          Started by BIOK.NT, Yesterday, 01:56 PM
          2 responses
          11 views
          0 likes
          Last Post BIOK.NT
          by BIOK.NT
           
          Started by i2ogu3, Yesterday, 11:31 PM
          0 responses
          4 views
          0 likes
          Last Post i2ogu3
          by i2ogu3
           
          Started by RDTrader16, Yesterday, 10:19 PM
          0 responses
          10 views
          0 likes
          Last Post RDTrader16  
          Started by gemify, 03-08-2023, 08:02 AM
          9 responses
          150 views
          0 likes
          Last Post culpepper  
          Working...
          X