MACD’s Color Switch Trading Strategy.

Creating the MACD Color Switch Trading Strategy.

Sofien Kaabar, CFA
7 min readDec 19, 2021


The MACD is famous for being a trend-following strategy and also for detecting divergences which may hint at a possible exhaustion and thus a contrarian signal. We can also trade the signal method of the MACD. In this article, we will try out another method which is the color switch, a technique borrowed from a cousin indicator which will be explained in detail in the article.

I have just released a new book after the success of my previous one “The Book of Trading Strategies”. It features advanced trend-following indicators and strategies with a GitHub page dedicated to the continuously updated code. Also, this book features the original colors after having optimized for printing costs. If you feel that this interests you, feel free to visit the below Amazon link, or if you prefer to buy the PDF version, you could contact me on LinkedIn.


The MACD is probably the second most known oscillator after the RSI. One that is heavily followed by traders. It stands for moving average convergence divergence and it is used mainly for divergences and flips. Many people also consider it a trend-following indicator but others use graphical analysis on it to find reversal points, making the MACD a versatile indicator.

USDCHF in the first panel with the MACD in the second panel.

Before we start building this oscillator, we must understand what moving averages are and how do we code them. Moving averages help us confirm and ride the trend. They are the most known technical indicator and this is because of their simplicity and their proven track record of adding value to the analyses. We can use them to find support and resistance levels, stops and targets, and to understand the underlying trend. This versatility makes them an indispensable tool in our trading arsenal.



Sofien Kaabar, CFA

Top writer in Finance, Investing, Business | Trader & Author

Recommended from Medium


See more recommendations