A Stock Trading Strategy With On-Balance Volume (OBV) & Python

8 min readDec 10, 2020

Stock Trading Strategy Using On-Balance Volume (OBV) & Python

Before we begin, if you enjoy my articles and content and would like more content on programming, stocks, machine learning, etc. , then please give this article a few claps, it definitely helps out and I truly appreciate it ! So let’s begin !

In this article you will learn a simple trading strategy used to predict price movements using the Python programming language. More specifically you will learn how to perform algorithmic trading. It is extremely hard to try and predict the stock market momentum direction, but in this article I will give it a try. Even people with a good understanding of statistics and probabilities have a hard time doing this.

Algorithmic trading is a process for executing orders utilizing automated and pre-programmed trading instructions to account for variables such as price, timing and volume. -investopedia.com

Python is one of the hottest programming languages for finance, so we will use it and an indicator called the On-Balance Volume or (OBV) to create a trading strategy to know when to buy and sell stocks.

Disclaimer: The material in this article is purely educational and should not be taken as professional investment advice. Invest at your own discretion.

What is On-Balance Volume (OBV)?

On-balance volume (OBV) is a technical trading momentum indicator that uses volume flow to predict changes in stock price.

Joseph Granville first developed the OBV metric in the 1963 book Granville’s New Key to Stock Market Profits.

Granville believed that volume was the key force behind markets and designed OBV to project when major moves in the markets would occur based on volume changes. In his book, he described the predictions generated by OBV as “a spring being wound tightly.” He believed that when volume increases sharply without a significant change in the stock’s price, the price will eventually jump upward or fall downward.-investopedia.com

OBV Trend Signals

  • When both price and OBV are making higher peaks and higher troughs, the upward trend is likely to…

Recommended from Medium


See more recommendations