The main idea behind the On Balance Volume indicator is to track the cumulative volume of a security over a specific period and use it to predict price trends, this type of indicator measures momentum. It was developed by Joseph Granville and introduced in his 1963 book, "Granville's New Key to Stock Market Profits"
The indicator is based on the principle that volume precedes price movement, so when volume increases significantly, it suggests a solid signal to buyers or sellers, which may show a potential price trend. This cBot strategy uses two indicators to determine a signal to open a buy or sell signal, this is the OBV indicator and a simple moving average indicator.
Here's how the On Balance Volume indicator is calculated:
The calculation of On-Balance Volume involves adding or subtracting the daily volume of a security based on the direction of its price movement:
If the current day's closing price is higher than the previous day's closing price, then the entire volume of that day is considered positive and added to the OBV.
If the current day's closing price is lower than the previous day's closing price, then the entire volume of that day is considered negative and subtracted from the OBV.
- If the current day's closing price is the same as the previous day's closing price, then the volume is considered neutral, and the OBV remains unchanged.
The resulting indicator line can then be plotted on a chart to analyze its movement for divergences or confirmations with the price action. If the price is in an uptrend, and the OBV is also rising then this will indicate a confirmation of the upward movement, but if the price is rising, but the OBV is declining, it could be a sign of potential weakness in the upward trend.
Word of Warning
Like any technical indicator, the On Balance Volume is not perfect and may produce false signals, especially in choppy or sideways markets. Therefore, it's often used together with other indicators and analysis methods to confirm trading decisions.
How Does the cBot Open & Close Trades?
This strategy will open a buy trade when the On Balance Volume value crosses above the simple moving average value and it opens a sell trade when the On Balance Volume value crosses below the simple moving average value. As you can see it is a simple strategy that combines two indicators to determine trade signals.
The indicator values are hard coded but can be easily adapted to a cBot parameter.
Stop Loss & Take Profit Calculation
A standard stop loss and take profit as well as position size can be set from the cBots parameter settings.
You can add additional risk management and other trade rules yourself or by contacting our development team.
On Balance, Volume cBot is provided with full source code by Spotware.com
How To View The Source Code
To view the source code for this cBot, you will first need to make sure you have downloaded and installed cTrader Desktop, you can also scroll to the bottom of this page for instructions on how to install the cBot. Once installed you will have the cTrader application open, next you need to navigate to the Automate application and click on the name of the cBot, the source should show in the right-hand window.
If you need more help watch a video tutorial on how to use cTrader Automate.
How to Attach Indicator to Chart
You do not need to attach the Supertrend indicator to your chart when you run the cBot, but it is a good idea to visually see the indicator to check your trade rules for opening and closing trades and any risk management.
Learn Algorithmic Trading
In this instructional guide, we aim to assist you in acquiring the necessary skills to engage in market trading through automated trading strategies (cBots) using the cTrader Desktop trading platform. By the conclusion of this tutorial, you will gain the confidence to employ a cTrader cBot alongside the Algo application of cTrader, enabling you to automatically execute and handle your market orders. This course is designed to familiarize novice traders with the fundamental principles of algorithmic trading utilizing the cTrader platform.
Learn Microsoft C# for Algo Trading
If you are new to coding your cTrader cBot for automated trading the following Microsoft C# course will help you modify the starter kit cBot in this download to add new features for your own personal trading strategy.
Algorithmic Trading Facts
A significant number of traders venture into algorithmic trading with the misconception that they have discovered a foolproof strategy that guarantees effortless wealth. However, this notion is far from reality. It is crucial to read this article, as it can save you valuable time and money.
How To Install & Remove
First, make sure you have the cTrader trading platform installed and then simply unzip the file and double-click on it to automatically install it onto the platform.
Any Questions?
If you have any questions, please first search our coding help forum for the answer, if you cannot find it, post a new question.
Need Coding Help?
We can help you modify this cBot for your own personal trading strategy, contact our team for a quote.
Need a Broker
If you are still looking for a broker you can trust, take a look at our best cTrader broker site.