Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/265.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP交易员macd返回错误_Php_Php Extension_Trading - Fatal编程技术网

PHP交易员macd返回错误

PHP交易员macd返回错误,php,php-extension,trading,Php,Php Extension,Trading,我想使用trader\u macd,但它总是返回false。 我正在使用默认参数: $data = [ 0 => "0.06945900", 1 => "0.06945200", 2 => "0.06948100", 3 => "0.06944100", 4 => "0.06939800", 5 => "0.06941800", 6 =>

我想使用trader\u macd,但它总是返回
false
。 我正在使用默认参数:

$data = [
0 => "0.06945900",
1 => "0.06945200",
2 => "0.06948100",
3 => "0.06944100",
4 => "0.06939800",
5 => "0.06941800",
6 => "0.06942300",
7 => "0.06940000",
8 => "0.06937700",
9 => "0.06937200",
10 => "0.06940000",
11 => "0.06939800",
12 => "0.06941100",
13 => "0.06944500",
14 => "0.06940100",
15 => "0.06942600",
16 => "0.06941500",
17 => "0.06941400",
18 => "0.06939900",
19 => "0.06941400",
20 => "0.06940700",
21 => "0.06938100",
22 => "0.06940400",
23 => "0.06937400",
24 => "0.06937000",
25 => "0.06939700"]

$result = trader_macd($data, 12, 26, 9)
当我设置最后一个参数($signalPeriod)时,得到一个值为
0
的数组:

0 => array:1 [▼
  24 => -0.0
]
1 => array:1 [▼
  24 => -0.0
]
2 => array:1 [▼
  24 => -0.0
]
当我使用其他方法(如trader_ema)处理相同的
$data
时,效果很好

我还将
trader.real\u precision
设置为
8

ini_set('trader.real_precision', '8');            
我做错了什么


我的系统使用PHP7.2.7和trader 0.5.0。

您没有足够的数据来计算您选择的信号线(MACD线的9天均线)。在数据数组中再添加八个条目,您将得到一个结果。或从~1997年开始降低信号线周期

PHP 2?真的吗?谢谢你的提示。我刚把它改成了7.2.7。