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