ApproxCompare() is mentioned in NinjaScript Best Practices, under the
section Floating Point Comparison in Miscellaneous Practices,
https://ninjatrader.com/support/help...neousPractices
It is documented here,
https://ninjatrader.com/support/help...roxcompare.htm
The problems with the ApproxCompare() documentation are many,
1. It is only found via the Search function.
- Why is ApproxCompare() not listed in the Language Reference Table of Contents?
- I mean, ApproxCompare() should be found under Common -> Analytical -- right?
2. The documentation is wrong.
- The 19 indicators using this method don't match the syntax provided.
- Syntax of ApproxCompare() should not be prefixed by the Math class.
- Since ApproxCompare() is an extension method, but the 'this' keyword is missing.
- The return value should be documented in terms of == 0, < 0, or > 0 -- not with -1 or 1.
- The HTML formatting for the Examples section is egregiously bad.
3. The "epsilon" value used by ApproxCompare() is not documented.
- The Best Practices section mentions ApproxCompare() is using an "epsilon" value comparison.
- Ok, so I doubt ApproxCompare() is using Double.Epsilon (this value is way too small).
- So, what is the "epsilon" value being used in ApproxCompare()?
- Shouldn't this "epsilon" value be documented?
I found 19 different indicators making use of this method. This method is a great extension
to the NinjaScript framework. The documentation should be updated and corrected.
---
(*) It's not really new, per se. NT7 had the undocumented Compare() extension method, see
NT7's @Stochastics.cs for an example use. The epsilon value used by NT7 Compare() was
"0.000000000001" or 1e-12 ... but that epsilon value was actually passed as an argument.
Comment