Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Whem to use MasterInstrument.Compare() ?

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

    Whem to use MasterInstrument.Compare() ?

    I've been reading into using the Compare method on floating point values in C#. What I don't understand is when to use it. Does one use it all the time when comparing two values or are there some guide lines on when it's needed and when it's not.

    My inclination is that it is important when the values are close to each other like during a crossover and the difference is small. But this would happen all the time. So does this mean that one should use the compare method all the time?

    Regards,

    taddypole...

    #2
    Hello,

    You could always use it. It most scenarios it would not be needed however when dealing with instruments that have decimals that could have floating point calculation errors it would be wise to use it.

    Believe you need a base understanding of where floating point errors are and how they could occur. We dont have anything in our help guide as this is more of a general programming concept.

    Let me know if I can be of further assistance.
    BrettNinjaTrader Product Management

    Comment

    Latest Posts

    Collapse

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