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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        63 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        92 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        48 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        106 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        63 views
        0 likes
        Last Post PaulMohn  
        Working...
        X