This is an example of how to recode an indicator to improve performance by eliminating dependencies on external classes and by not performing, on every tick, operations only required on the first tick of a bar.
The custom methods that were added to replace the calls to the MAX, MIN, and StdDev classes need to keep track of variables that are specific to each of the different callers. Arrays of DataSeries, doubles, and integers are used to accomplish that. Each caller has its own integer key to make sure that it uses its own reserved set of variables. That' is what makes this whole idea workable. For me this is a proof of concept more than anything else.
Image compares the new version FoM2 to the original one. The outputs are not identical, there are discrepancies of about .0.2% of the magnitude of the output, I am not sure why.
Comment