Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Perform calculations "once"

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

    #16
    Originally posted by NinjaTrader_Josh View Post
    Please also consider Round2TickSize: http://www.ninjatrader-support.com/H...2TickSize.html
    Hey Josh, I'm not sure how to code this, can you help me with an example?

    The link says:
    Syntax
    Instrument.MasterInstrument.Round2TickSize(double price)

    I'm not sure if I apply this to all the times that I am using a variable that has to do with price, such as I would do with Koganams example.

    Comment


      #17
      Hi sauer11155,

      You have a double value. Any time you want to round it up to the instrument's tick size you need to use it. Otherwise if you already finished all calculations you can just set the double value to take on the rounded value and then you can call the double value directly.

      Code:
      double value = 133.23901903;
      value = Instrument.MasterInstrument.Round2TickSize(value);
      Josh P.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      388 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      260 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      218 views
      1 like
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      302 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      268 views
      0 likes
      Last Post CarlTrading  
      Working...
      X