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 Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          559 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          324 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          546 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          547 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X