The Moving Average Convergence Divergence (MACD) crossover indicator is a popular tool used in the technical analysis of stock prices to identify changes in the strength, direction, momentum, and duration of a trend in a stock's price. The MACD components are the MACD, Signal and Histogram.
- MACD is the difference between the 12-day and 26-day Exponential Moving Averages (EMAs).
- The signal is typically a 9-day EMA of the MACD Line.
- The histogram is the difference between the MACD Line and the Signal Line. It is plotted as bars and can indicate the momentum of the trend.
MACD Crossovers
Bullish Crossover (Buy Signal): This occurs when the MACD Line crosses above the Signal Line as it suggests that the price might be starting an upward trend.
Bearish Crossover (Sell Signal): This occurs when the MACD Line crosses below the Signal Line as it suggests that the price might be starting a downward trend.
We use the MACD with the Relative Strength Index (RSI) indicator for a better trading signal.
Combined MACD and RSI Strategy
Using MACD and RSI together can enhance the reliability of trading signals by using the MACD to identify the overall trend and the RSI to confirm if the stock is in an overbought or oversold condition within that trend.
Avoid False Signals
A buy signal might be stronger if the MACD indicates a bullish crossover while the RSI is coming out of an oversold condition and a sell signal might be stronger if the MACD indicates a bearish crossover while the RSI is coming out of an overbought condition.
The strategy contains the full source code. It is for educational purposes to help traders with various levels of programming knowledge learn the following skills using Microsoft C# and the cTrader API. This cBot was created by the ClickAlgo Strategy Building Tool in a few minutes with no coding.
Risk Management
In addition to the trade signals to open trades automatically, the cBot also uses some basic risk management in the form of the variable position size based on the percentage of the account balance, this unique feature will automatically increase the position (lot) size as your account balance grows for maximum profits. Also, included is a standard take profit and stop loss option.
Telegram Alerts
This strategy also includes a feature to send Telegram alerts when the system provides a signal to buy or sell and when a trade opens.
You can add risk management features and other trade rules by contacting our development team.
Built Using the Algo Strategy Builder
This cBot was built with no coding required using the cTrader Algorithmic Strategy Builder for the cTrader Platform.
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, 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.
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 personal trading strategy.
Algorithmic Trading Facts
Many 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.
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 a Broker
If you are still looking for a trustful broker, look at our best cTrader broker site.
All cBot Code Examples
You can access all of our free cTrader cBot code examples here.