Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicators decimal places on chart vs code

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

    Indicators decimal places on chart vs code

    Hi devs,

    When I add an indicator like the ATR to the chart, its value is displayed with 2 decimal places. However, when I read its values from within a strategy, the number of decimal places is greater, and there are instances where the values shown on the chart and in the code can differ. For example, on the chart, I might see an ATR of 10.00, while the code reads 9.999456392. I would like to know what rounding method the chart uses to display 2 decimal places so that I can apply the same method when reading values from within a strategy.

    I appreciate your assistance.

    #2
    Hello Quanto,

    While I cannot provide the internal code of the NinjaTrader Desktop platform, I can point you to the Microsoft Documentation on how to round values to any specific amount of decimal places.


    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your answer Chelsea,

      I understand that you cannot provide me with NinjaTrader's internal code, but there are four alternatives I could use according to your response:
      1. Round(ATR[x], 2);
      2. Round(ATR[x], 2, MidpointRounding.AwayFromZero);
      3. Round(ATR[x], 2, MidpointRounding.ToEven);
      4. Round(ATR[x], 2, MidpointRounding.ToZero);
      Which of the four could I use to get a result as close as possible to what I see in the ATR indicator on the chart?

      Comment


        #4
        Hello Quanto,

        Round(ATR[x], 2) is most likely the same or similar to what is being used for the rounding on plot values.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        648 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        572 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        573 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X