Coins: 14,027
Exchanges: 1,065
Market Cap: $2.509T 2.7%
24h Vol: $67.812B
Gas: 6 GWEI
Go Ad-free
Trading
TABLE OF CONTENTS

Strategizing With the On-Balance Volume (OBV) Indicator in Crypto

4.8 | by Jackson Henning

The On-Balance Volume Indicator (OBV)

The On Balance Volume Indicator is a momentum indicator that uses the cumulative volume of an asset to signal upcoming trend reversals or breakouts. 


Key Takeaways

  • The OBV is the cumulative sum of volume flowing in and out of a security, and is referred to as a leading indicator as it is intended to reveal the actions of large players in a market before the effects are apparent in the price action.

  • Discrepancies and divergences in the price action of an asset can be taken as a potential indication of a near time price reversal.

  • The OBV can house a number of false signals, as parameters, time periods, and the asset itself can constitute a variation in the success or failure of the strategy.


What is OBV indicator

The rise of online banking has allowed depositors to withdraw funds from commercial banks in a hasty and perfunctory manner. While convenient for clients, it can prove detrimental for banks. There are substantial precedents expressing this threat, with the recently condemned Silicon Valley Bank (SVB) being a primary example. According to Federal Reserve data, 25.3% of deposits were drained on the 9th of March 2023 and an additional 60.2% was scheduled to be withdrawn on the 10th. This peak of one-day withdrawals from the SVB was well above that experienced by Washington Mutual Bank in 2008, which resulted in the largest bank failure in history. The largest one-day withdrawal at the bank reached just over 2%. Hence, being aware of volume and money flows can be integral to identifying the strength of a firm or an asset. Especially in the domain of crypto, comprehending volume can be influential to trading given the ease with which money can flow.

Understanding the Indicator

Price and volume are two fundamental components of technical analysis. Volume is the total number of shares/contracts traded within a specified timeframe. Therefore, the higher the volume, the greater the liquidity. Traders like to see volume slowly increase in the direction of the price trend they have predicted. To visualize this, traders have popularized the use of the On-Balance Volume (OBV) indicator. Its function – simple yet vital – is to indicate to traders if money is flowing in or out of an asset.

The OBV is a momentum indicator. By taking the cumulative sum of an asset’s volume, it is intended to act as a leading indicator: signaling upcoming trend reversals or breakouts. Introduced in 1963 by Joe Granville, the OBV indicator is colloquially referred to as the “smart money indicator,” as it is intended to reveal the actions of large players in a market before the effects become apparent in the price action. This can be extremely useful to identify whale movements in crypto markets. Joe Granville’s ingenuity lies in the fact that the OBV was one of the first indicators to account for both the positive and negative flow of volume.

How to Calculate the On-Balance Volume Indicator?

The OBV is the cumulative sum of volume flowing in and out of an asset. Due to the assumption that volume leads the price action, the OBV has received the moniker of a “leading indicator.” Preceding how it is utilized, looking at how it is calculated can be largely beneficial:

In the event today’s closing price is greater than yesterday’s:

Current OBV = Previous OBV + Today’s Volume

In the event the previous closing price is equal to today’s:

Current OBV = Previous OBV - Today’s Volume

If today’s closing price is equal to yesterday’s:

Current OBV = Previous OBV

As displayed above, the calculation of the OBV is seemingly undemanding. 

For crypto trading purposes, you can pull up the indicator easily on GeckoTerminal. All you have to do is select a desired liquidity pool featuring your token of interest, select “indicators”, and type in OBV for it to appear. This is shown in the image below:

OBV GeckoTerminal 

Standard and Hidden Divergences

Conceptually, the price action of an asset should follow its OBV, as the OBV is a simple line chart of the amalgamated volume. Any discrepancies can be taken as a potential indication of a near time price reversal. Similar to the RSI, the OBV can reveal standard or hidden divergences. 

Standard Divergences

Standard/normal divergences take both bullish and bearish forms. Bullish divergences occur when the price action reaches a lower low (LL) and the oscillator (the OBV) takes a higher low (HL). Bearish divergences are the antithesis, with them occurring when the price action reaches higher highs (HH) and the oscillator takes lower highs (LH). A bearish standard divergence is displayed in the graph below. As illustrated in the chart, the WETC/USDC price action takes on a higher high, while the OBV action reaches a lower high. The signal issued by this divergence is demonstrated by the cryptocurrency’s ensuing bearish trend.

Divergences OBV

Hidden Divergences

Hidden divergences are named after their eponymous nature – being well-hidden. Bullish hidden divergences take place where the price action reaches a higher low (HL) and the OBV reaches lower lows (LL). Conversely, bearish hidden divergences materialize when the price action reaches a lower high (LH) and the indicator achieves a higher high (HH). An example of a bullish hidden divergence is displayed below. Notice how the price action of the WETH/USDC pool achieves a higher low as the OBV veers to a lower low, signaling the bullish continuation that follows. 

Hidden Divergences OBV

Alternatively, one can tentatively conclude that a trend reversal might occur with an OBV trendline. The signal supplied by the OBV can precede the price action breakout. In the event of a bullish breakout, this would suggest the price of the crypto asset loitered behind the increasing volume, forcing the market to respond to the mass of bulls and buy orders, triggering a breakout.

Separating the OBV From Other Volume Indicators

The Accumulation/Distribution Line (A/D) attempts to measure the flow of money into and out of an asset. Although easily misconstrued, the A/D line varies from the OBV, as it takes the opening as well as the closing prices into its calculation. It is calculated by taking the money flow multiplier (MFM):

MFM = (Close-Low)/(High-Close)/(High-Low)

Multiplying this MFM by the period volume will obtain the Money Flow Volume (MFV). The multiplication of the current MFV and the previous A/D will obtain the current A/D. Similar to the OBV, this figure is plotted in a line graph and it is also used as a viable divergence indicator. The primary issue with the A/D line is that it does not reflect price gaps. This means that the MFM does not include changes in price ranges between periods, causing the A/D line to inaccurately reflect the price action.

MFM

Secondly, the OBV can be compared to the Ease of Movement (EOM) indicator. This oscillator reflects the amount of volume that is required to move the price of an asset. EOM is plotted on a line graph, with a midpoint of zero, and is normally smoothed with a 14-day moving average. When the price is moving up on light volume, the indicator shows high values above zero. Low values are displayed when price is moving downward on light volume. If a mass of volume is required to move the price, the indicator stays near zero. 

Long signals are divulged when the EOM crosses from below to above zero, short signals are given in the opposite scenario. The Ease of Movement is a euphemism for how far price shifts per unit of trading volume. Hence, if less volume is able to alter the price action to a greater extent, there is a superior ease of movement in the asset. The EOM is also used in determining states of divergences. Nevertheless, it is not a standalone indicator. It is often used to confirm the signals propagated by other indicators.

EOM

Flaws: How to Run Backtests to Check for False Signals

The OBV is a straightforward tool. However, as it is a leading indicator, it can house a number of false signals. This becomes apparent when utilizing the OBV with an SMA, one of the most popularized ways to use the indicator in a strategy. The following demonstrates how to construct an OBV-based strategy, and the backtested results of the OBV-SMA. The below code can be visualized using any web-based computing platform, such as Jupyter. 

First and foremost, obtaining historical price data from CoinGecko API allows us to construct a dataframe.

Pandas dataframe

Import CoinGecko API data

This displays a pandas dataframe of the price, market cap, and the volume of ETH for the past 100 days, on a daily basis, aggregated across the 100 pools featuring Ether taken by CoinGecko. To recapitulate, CoinGecko aggregates all the pools featuring ETH, aggregating its price, and making it simple to convert into a pandas dataframe. I went about this in a slightly peculiar way: slicing the produced array, isolating for figures I wanted, and making it a readable dataframe.

Visualizing data

To visualize the price action over the past 100 days, and save the file, one can employ the above code. Now to create the moving average and the OBV indicator. The below code creates both an SMA and EMA, in the event the user wishes to manipulate their output. Then in plotting the OBV and SMA, the code produces the subsequent graph. To calculate OBV one can use the numpy cumulative sum function, accumulating volume based on the sign of the price change. In the event the price change is positive, the function takes the corresponding volume value, and adds it to the numpy array. If the price change is less than zero it subtracts (-Volume) the volume from the running total, and if it is equal (hence both other conditions are not true) it assigns a value of zero (as in no change). This is in accordance with the calculation of the OBV listed at the start of this article.

Plotting chart

 

OBV chart

A buy signal is created if the value of signal[col1] = df[‘obv’] is greater than the ‘obv_ma’ column at the same point, i.e. The LongShort function checks to see if the flag is equal to 1, if it is not, a buy signal is given and the flag value is set to 1. A sell signal is given when the converse happens, and the function checks for a value of zero, assigning a value of zero if these conditions are true. Then two columns of LongPrices and ShortPrices are created. Check out @ComputerSciencecompsci112358 for learning how to create other functions similar to this; he has a lot of useful videos concerning trading strategies.

Long Short Signal

The OBV-SMA strategy revolves around SMA crossovers. So, in the event the SMA crosses over the OBV line graph a buy or sell signal is created. Visualizing these sell orders produces:

Visualizing Buy and SellLong Short Signal Chart

At a glance, one can already denote the unexpected long and short signals generated by this strategy. To test for its numerical results, one can utilize the strategy_result function below. This checks the ‘Signal’ column to see if there is a buy order (=1) or sell order (=0) in the column. If there are, it changes the position we are in (waiting_for_close) and adds the price to the newly created variable. Check out Diego Degese on Medium for more insight into various trading strategies.

Strategy results

This strategy produced a 26.09% win rate on 23 trades, 17 being losses, and a total profit/loss of -$180.77. Now, this does not serve to discredit the entirety of this strategy, but it rather highlights the importance of backtesting a strategy. In adjusting the SMA and time period to 365 days, I obtained a win rate of 31.43%, producing a profit of $185.73. This was due to one bullish signal in July 2022 and two massive shorts indicated during September and November of 2022. Parameters, time periods, securities, all change and constitute a variation in the success or failure of the same strategy. Now, the parameters of this strategy can be manipulated to obtain better results, but one must be careful of data-snooping bias. This is the tailoring of numerous parameters to a single backtest, befitting it to circumstantial events in the past that may not repeat themselves in the future.

OBV + Autocorrelation Strategy

Out of interest, I sought to test the viability of combining the OBV, a measure of the cumulative volume flow of an asset, and Autocorrelation (ACI) – a measure that quantifies the correlation between an asset's price at different time lags. 

Positive autocorrelation (ACI>0) indicates a tendency for the price to continue moving in the same direction and negative autocorrelation (ACI<0) suggests a tendency for the price to reverse its direction over consecutive time periods. This helps traders in identifying periods of momentum or persistence in price movements. 

Therefore, in combining the two strategies a bullish signal is generated when the OBV is trending upwards (indicating buying pressure) and the ACI is positive (indicating persistence in the price trend). Alternatively, a bullish signal can arrive when the OBV is trending downwards (indicating selling pressure) and the ACI is negative (suggesting a reversal in the price trend). The inverse of these indications supplies traders with bearish signals.

Autocorrelation

Long signals were identified if the ACI was above 0.8 and the OBV was increasing, or if the ACI was below 0.8 and the OBV was decreasing. The former suggested a persisting trend, and the latter a potential trend reversal. Likewise, sell signals were generated if the ACI was greater than 0.8 and the OBV was decreasing (persisting down-trend) or if the ACI was less than 0.8 and the OBV was increasing (potential reversal).

Identifying signals with ACi

This generated a profit of $698.3 over 365 days, with only 9 signals generated, resulting in a 55.56% win rate. Although seemingly appealing, this strategy is easily susceptible to data snooping complications, causing its high success rate. Additionally, the low number of signals generated suggests this strategy had overly restrictive conditions. Anyhow, it is always useful and interesting to backtest.

Strategy results 2

All information and examples in this article are provided for informational purposes only, and should not be taken as financial advice. 


Fetch Historical Crypto Price Data with CoinGecko API

Advanced traders who want to fetch real-time and historical crypto price data, get access to more API endpoints, and avoid getting rate limited, may consider subscribing to our Analyst API plan. The CoinGecko API currently has 50+ endpoints, tracks 10,000+ coins across 700+ exchanges and 3,000+ NFT collections serving billions of API calls each month.

If you require a custom solution, fill in the form below to get in touch with our API sales team:

CoinGecko's Content Editorial Guidelines
CoinGecko’s content aims to demystify the crypto industry. While certain posts you see may be sponsored, we strive to uphold the highest standards of editorial quality and integrity, and do not publish any content that has not been vetted by our editors.
Learn more
Tell us how much you like this article!
Vote count: 8
Jackson Henning
Jackson Henning

Jackson Henning has a background in economics and has spent 3 years in crypto, primarily ensconced in NFTs and DeFi. He is especially intrigued by the perpetual ingenuity common to crypto trading, along with the employment of technical analysis and the ability of DeFi to push the bounds of traditional finance. Follow the author on Twitter @Henninng

More Articles


Explore Polkadot's Ecosystem
Discover trending dApps, wallets, DeFi & more

What is Zeebu?
Learn more about the Web3 neobank


coingecko
Continue in app
Track prices in real-time
Open App
Select Currency
Suggested Currencies
USD
US Dollar
IDR
Indonesian Rupiah
TWD
New Taiwan Dollar
EUR
Euro
KRW
South Korean Won
JPY
Japanese Yen
RUB
Russian Ruble
CNY
Chinese Yuan
Fiat Currencies
AED
United Arab Emirates Dirham
ARS
Argentine Peso
AUD
Australian Dollar
BDT
Bangladeshi Taka
BHD
Bahraini Dinar
BMD
Bermudian Dollar
BRL
Brazil Real
CAD
Canadian Dollar
CHF
Swiss Franc
CLP
Chilean Peso
CZK
Czech Koruna
DKK
Danish Krone
GBP
British Pound Sterling
GEL
Georgian Lari
HKD
Hong Kong Dollar
HUF
Hungarian Forint
ILS
Israeli New Shekel
INR
Indian Rupee
KWD
Kuwaiti Dinar
LKR
Sri Lankan Rupee
MMK
Burmese Kyat
MXN
Mexican Peso
MYR
Malaysian Ringgit
NGN
Nigerian Naira
NOK
Norwegian Krone
NZD
New Zealand Dollar
PHP
Philippine Peso
PKR
Pakistani Rupee
PLN
Polish Zloty
SAR
Saudi Riyal
SEK
Swedish Krona
SGD
Singapore Dollar
THB
Thai Baht
TRY
Turkish Lira
UAH
Ukrainian hryvnia
VEF
Venezuelan bolívar fuerte
VND
Vietnamese đồng
ZAR
South African Rand
XDR
IMF Special Drawing Rights
Cryptocurrencies
BTC
Bitcoin
ETH
Ether
LTC
Litecoin
BCH
Bitcoin Cash
BNB
Binance Coin
EOS
EOS
XRP
XRP
XLM
Lumens
LINK
Chainlink
DOT
Polkadot
YFI
Yearn.finance
Bitcoin Units
BITS
Bits
SATS
Satoshi
Commodities
XAG
Silver - Troy Ounce
XAU
Gold - Troy Ounce
Select Language
Popular Languages
EN
English
RU
Русский
DE
Deutsch
PL
język polski
ES
Español
VI
Tiếng việt
FR
Français
PT
Português
All Languages
AR
العربية
BG
български
CS
čeština
DA
dansk
EL
Ελληνικά
FI
suomen kieli
HE
עִבְרִית
HI
हिंदी
HR
hrvatski
HU
Magyar nyelv
ID
Bahasa Indonesia
IT
Italiano
JA
日本語
KO
한국어
LT
lietuvių kalba
NL
Nederlands
NO
norsk
RO
Limba română
SK
slovenský jazyk
SL
slovenski jezik
SV
Svenska
TH
ภาษาไทย
TR
Türkçe
UK
украї́нська мо́ва
ZH
简体中文
ZH-TW
繁體中文
Login to track your favorite coin easily 🚀
By continuing, you agree to CoinGecko Terms of Service and acknowledge you’ve read our Privacy Policy
or
Forgot your password?
Didn't receive confirmation instructions?
Resend confirmation instructions
IT'S FREE! Track your favorite coin easily with CoinGecko 🚀
By continuing, you agree to CoinGecko Terms of Service and acknowledge you’ve read our Privacy Policy
or
Password must contain at least 8 characters including 1 uppercase letter, 1 lowercase letter, 1 number, and 1 special character
Didn't receive confirmation instructions?
Resend confirmation instructions
Forgot your password?
You will receive an email with instructions on how to reset your password in a few minutes.
Resend confirmation instructions
You will receive an email with instructions for how to confirm your email address in a few minutes.
Get the CoinGecko app.
Scan this QR code to download the app now App QR Code Or check it out in the app stores