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 charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      55 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      142 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      160 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      96 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      276 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X