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 CarlTrading, 03-31-2026, 09:41 PM
          1 response
          155 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          90 views
          1 like
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          137 views
          2 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          130 views
          1 like
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          107 views
          0 likes
          Last Post CarlTrading  
          Working...
          X