Announcement

Collapse
No announcement yet.

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.
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment


          #5
          Thx BrandonH

          that's work !

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Hwop38, 05-04-2026, 07:02 PM
          0 responses
          150 views
          0 likes
          Last Post Hwop38
          by Hwop38
           
          Started by CaptainJack, 04-24-2026, 11:07 PM
          0 responses
          302 views
          0 likes
          Last Post CaptainJack  
          Started by Mindset, 04-21-2026, 06:46 AM
          0 responses
          243 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by M4ndoo, 04-20-2026, 05:21 PM
          0 responses
          345 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by M4ndoo, 04-19-2026, 05:54 PM
          0 responses
          174 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Working...
          X