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
talib.AD
talib.ADOSC
talib.OBV
Volatility Indicators
Cycle Indicators
Price Transform
Statistic Functions
Math Transform
Math Operators
Pattern Recognition
OS
Structures
Built-in Variables and Constants
Conventions
Exchanges

Calculates the On Balance Volume.

talib.OBV(inReal)
talib.OBV(inReal, inPriceV)

Examples

Compute the On Balance Volume from the latest K-lines.

javascript
function main() { var records = exchange.GetRecords() if (!records) return var ret = talib.OBV(records) Log(ret) }
python
import talib def main(): records = exchange.GetRecords() if not records: return ret = talib.OBV(records.Close, records.Volume) Log(ret)

Returns

TypeDescription

numeric array

Indicator values, the same length as the input; the leading values without enough data are NaN.

Arguments

NameTypeRequiredDescription

inReal

Record array / numeric array

Yes

K-line data (the close price and volume are used) or a numeric array of close prices.

inPriceV

Record array / numeric array

No

Volume: not needed when inReal is K-line data; required when inReal is a close-price array (pass K-line data to use its volume, or a numeric array of volumes).

See Also

Remarks

TA-Lib equivalent: OBV(Records[Close],Records[Volume]) = Array(outReal).