calculate_on_balance_volume#
API documentation for tradeexecutor.visual.custom_indicators.calculate_on_balance_volume Python function.
- calculate_on_balance_volume(close_prices, volume)[source]#
Calculates the on balance volume from the close prices
Logic for obv is as follows: - For the first data point, OBV = Volume. - For the rest of the data points
if the current close price is higher than the previous close price, then OBV = previous OBV + Volume.
If the current close price is lower than the previous close price, then OBV = previous OBV - Volume.
If the current close price is equal to the previous close price, then OBV = previous OBV.