略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: trader_bop

2024-11-14

trader_bop

(PECL trader >= 0.2.0)

trader_bopBalance Of Power

说明

trader_bop(
    array $open,
    array $high,
    array $low,
    array $close
): array

参数

open

开盘价,浮点数数组。

high

高价,浮点数数组。

low

低价,浮点数数组。

close

收盘价,浮点数数组。

返回值

Returns an array with calculated data or false on failure.

add a noteadd a note

User Contributed Notes 1 note

up
1
geekgirl dot joy at gmail dot com
1 year ago
<?php

$opens
= array(135.83, 139.52, 143.43, 143.6);
$highs = array(136.74, 141.99, 144.3, 144.3);
$lows = array(130.21, 136.7, 140.41, 141.37);
$closes = array(131.96, 137.09, 142.06, 143.16);

// (Close - Open) / (High - Low)
$Balance_Of_Power = trader_bop($opens, $highs, $lows, $closes);

var_dump($Balance_Of_Power);
/*
array(4) {
  [0]=>
  float(-0.593) // (131.96 - 135.83) / (136.74 - 130.21)
  [1]=>
  float(-0.459) // (137.09 - 139.52) / (141.99 - 136.7)
  [2]=>
  float(-0.352) // (142.06 - 143.43) / (144.3 - 140.41)
  [3]=>
  float(-0.15)  // (143.16 - 143.6) / (144.3 - 141.37)
}
*/

官方地址:https://www.php.net/manual/en/function.trader-bop.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3