Reputation: 41
I would like to use the PHP trader_ema function. However the input of a array with a leading zero's resultants in zero. Example:
realArray = array(0.0000002,0.000004,0.00005,0.00003);
var_dump(trader_ema ( $realArray, 2 ));
//Output:
array(5) { [1]=> float(0) [2]=> float(0) [3]=> float(0) [4]=> float(0) }
I think the problem is that PHP stores it's float into the array with scientific notation. But after searching I haven't found a solution yet. Any ideas?
Upvotes: 1
Views: 768
Reputation: 27
Try setting up this option:
ini_set('trader.real_precision', '8');
var_dump(trader_ema(array(0.0000002, 0.000004, 0.00005, 0.00003), 2 ));
output:
array(3) {
[1]=>
float(2.1E-6)
[2]=>
float(3.403E-5)
[3]=>
float(3.134E-5)
}
Upvotes: 1