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 funk10101, Today, 09:43 PM
          0 responses
          6 views
          0 likes
          Last Post funk10101  
          Started by pkefal, 04-11-2024, 07:39 AM
          11 responses
          37 views
          0 likes
          Last Post jeronymite  
          Started by bill2023, Yesterday, 08:51 AM
          8 responses
          44 views
          0 likes
          Last Post bill2023  
          Started by yertle, Today, 08:38 AM
          6 responses
          26 views
          0 likes
          Last Post ryjoga
          by ryjoga
           
          Started by algospoke, Yesterday, 06:40 PM
          2 responses
          24 views
          0 likes
          Last Post algospoke  
          Working...
          X