ChartDirector 5.1 (PHP Edition)

ArrayMath.financeDiv


Usage

financeDiv(b, zeroByZeroValue)

Description

Divides the ArrayMath object by the given array, with special handling of the case of zero divided by zero.

In many financial formulas, it is possible to have cases of zero divided by zero. For example, the Relative Strength Index is defined as the ratio between positive price changes and absolute value of all price changes over a period of time. In case the price does not change at all during that period, and the RSI will become zero divided by zero.

Traditionally, under the above case, the RSI will be consider as 50%.

To handle these special cases, the financeDiv method has an argument specifying what value to assume in case the division is zero divided by zero.

Arguments

ArgumentDefaultDescription
b(Mandatory)An array of numbers used as divisors to divide the ArrayMath object.
zeroByZeroValue(Mandatory)The value to use if the division is zero divided by zero.

Return Value

The current ArrayMath object.