Type/to search
Built-in Functions
Global
Log
Market
Trade
Account
Futures
Exchange
IO
Network
Storage
Threads
TA
Talib
Overlap Studies
Momentum Indicators
Volume Indicators
Volatility Indicators
Cycle Indicators
Price Transform
Statistic Functions
Math Transform
Math Operators
talib.ADD
talib.DIV
talib.MAX
talib.MAXINDEX
talib.MIN
talib.MININDEX
talib.MINMAX
talib.MINMAXINDEX
talib.MULT
talib.SUB
talib.SUM
Pattern Recognition
OS
Structures
Built-in Variables and Constants
Conventions
Exchanges

Divides the first array by the second, element by element (Vector Arithmetic Div).

talib.DIV(inReal0, inReal1)

Examples

Divide the close price of each K-line by its open price.

javascript
function main() { var records = exchange.GetRecords() if (!records) return // close price divided by open price var closes = records.map(function(r) { return r.Close }) var opens = records.map(function(r) { return r.Open }) var ret = talib.DIV(closes, opens) Log(ret) }
python
import talib def main(): records = exchange.GetRecords() if not records: return # close price divided by open price ret = talib.DIV(records.Close, records.Open) Log(ret)

Returns

TypeDescription

numeric array

Results, the same length as the input.

Arguments

NameTypeRequiredDescription

inReal0

numeric array

Yes

First series.

inReal1

numeric array

Yes

Second series; it must have the same length as inReal0.

See Also

Remarks

TA-Lib equivalent: DIV(Array(inReal0),Array(inReal1)) = Array(outReal).

Calculates inReal0[i] / inReal1[i] element by element.

In JavaScript, both inputs must be numeric arrays (extract a field from the K-line data with map first): if a K-line array is passed, both inputs take the close price of the same K-line data and the result is meaningless; arrays of different lengths raise an error.