|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-01-08 17:52 UTC] ab@php.net
-Status: Open
+Status: Not a bug
[2016-01-08 17:52 UTC] ab@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 09:00:01 2025 UTC |
Description: ------------ It appears all of the EMA functions within the Trader PECL package return their responses to a fixed 2 decimal places. When trading, having 5 decimal places of precision is required and as such, these functions in their current form are somewhat useless. I'd like to suggest implementing a third, optional parameter for $precision: array trader_ema ( array $real, integer $timePeriod [, integer $precision = 2] ) For backwards compatibility reasons, I'd suggest the default value remains set to 2 to mimic current behavior so the change is non-breaking. This change request applies to the following functions (although many more of the Trader functions might also benefit from this too): - trader_dema - trader_ema - trader_tema Test script: --------------- $real = [ 1.00215, 1.00217, 1.00209, 1.00205, 1.00211, 1.00211, 1.00215, 1.00217, 1.00209, 1.00205, 1.00211, 1.00211, 1.00215, 1.00217, 1.00209, 1.00205, 1.00211, 1.00211 1.00215, 1.00217, 1.00209, 1.00205, 1.00211, 1.00215 ]; $emas = trader_ema($real, 10); print_r($emas); // All resulting values have been fixed to 2DP Expected result: ---------------- Either the resulting values from the EMA functions should mimic the maximum number of decimal places supplied in the $real array. Or, better yet, we should be able to specify an additional, optional argument for the precision as mentioned above. Actual result: -------------- All resulting values are fixed to 2DP.