Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

eliminate decimals

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

    eliminate decimals

    Hello,

    I know its possible in Print() to reduce decimals with ToString("N2")

    But what about a double result calculation.

    For exemple, a variable named fibo return an answer of 1.0666678
    Is it possible to round the number directly at the fibo variable and not just in Print(format)?

    The closest i have seen in nt would be
    floating-point arithmetic.

    #2
    Hello frankduc,

    Thanks for your post.

    This can be done using a method to round the value. I have included resources below for more information on how variables can be rounded.

    RoundToTickSize (NinjaScript documentation) - https://ninjatrader.com/support/help...toticksize.htm

    Math.Round (Publicly Available C# documentation) - https://docs.microsoft.com/en-us/dot...tframework-4.5

    Math.Floor (Publicly Available C# documentation) - https://docs.microsoft.com/en-us/dot...tframework-4.5

    Please let me know if I can be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    44 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    54 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    34 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    95 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    57 views
    0 likes
    Last Post PaulMohn  
    Working...
    X