Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by ttrader23, 05-08-2024, 09:04 AM
    10 responses
    48 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by agclub, 04-21-2024, 08:57 PM
    6 responses
    40 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by thumper57, 05-11-2024, 04:30 PM
    9 responses
    28 views
    0 likes
    Last Post thumper57  
    Started by Seneca, 08-25-2020, 08:31 AM
    2 responses
    5,945 views
    0 likes
    Last Post Tin34
    by Tin34
     
    Started by casabella, Today, 04:12 AM
    0 responses
    14 views
    0 likes
    Last Post casabella  
    Working...
    X