On Balance Volume
OBV measures buying and selling pressure based on volume flow.
Method
tm.ta.obv(source_close, source_volume)
Inputs
Parameter | Argument type | Description | Default Value |
---|---|---|---|
source_close | pd.Series | Close prices series | - |
source_volume | pd.Series | Volume series | - |
Outputs
Output | Type |
---|---|
obv | np.ndarray |
Example usage
import tradomate as tm
@tm.strategy()def my_strategy(config: tm.TradomateConfig, data: tm.TradomateData):
# Trying out On Balance Volume obv = tm.ta.obv(data.close, data.volume)
# Get the last value and print last_value = obv.iloc[-1] tm.log(f"Last value of On Balance Volume is {last_value}")
# Plot the values of obv tm.plot(obv, title="On Balance Volume", overlay=False)