Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

rounding funtion to 2 decimal places

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

    rounding funtion to 2 decimal places

    Good afternoon, I am trying to round a double variable to 2 decimal places to represent a specific price.

    I am currently using:


    variableRounded = ((int)Math.Round(variable/10))*10;

    This seems to round to the whole number.

    How can I round to 2 decimal places?

    Thanks so much for you help,
    Ryan

    #2
    Tonkingrf1551 Try this:
    Code:
    variableRounded = Math.Round(variable*100)/100;
    Thanks.
    Multi-Dimensional Managed Trading
    jeronymite
    NinjaTrader Ecosystem Vendor - Mizpah Software

    Comment


      #3
      Thank you very much jeronymite.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by kinfxhk, 07-14-2026, 09:39 AM
      0 responses
      15 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 07-13-2026, 10:18 AM
      0 responses
      59 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 07-13-2026, 09:50 AM
      0 responses
      42 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 07-13-2026, 07:21 AM
      0 responses
      47 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 07-11-2026, 02:11 AM
      0 responses
      38 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Working...
      X