MACD based crypto trading outperforms the market (during bear regimes, all of 2018 and 2019) Cryzen Follow May 29, 2019 · 4 min read

What is the MACD again?

The MACD (Moving Average Convergence Divergence) indicator is a technical analysis indicator that indicates price trends for a given asset.

In particular, the MACD is defined as:

MACD = (12 period EMA) - (26 period EMA)

EMA → Exponential Moving Average (recent data is weighted more, exponentially so)

Concretely, this is what the MACD computation looks like:

If the MACD is positive, this means the short term exponential average is larger in value than the long term exponential average — this happens when your price data is trending upwards, as seen above. The opposite is true for downtrends.

Each time we have a new price candle, we shift the short term and long term window above and recompute the MACD with the most recent data.

What happens if we use the MACD for trading crypto?

A whopping 107.45% return (run on eth_usdt), during a period where eth lost 67% in value.

The MACD is again an indicator that gives information about price trends — it can be used in various ways for trading. Share link for result above: https://www.cryzen.com/result/8175/d7ec7e62-5977-447e-a899-f5e8d3052b03

In our specific MACD strategy, we assume that when the MACD value is low or below -1.5 to be specific (i.e. there has been a downtrend that was pretty bad) we buy. When the MACD value returns to 0 (the start of an uptrend), we sell.

Our choices for buy and sell thresholds could have been different. But using the above, we are able to make significant profits on ethereum from the start of 2018 to the present day:

MACD Strategy Returns

The strategy above leads to gains of 107.45% while ethereum loses 67% in value over the same time!

This strategy, however, does not fare as well during bull markets in which it sells “too” early. We recommend playing around with the buy and sell triggers to find something better suited for a bull market.

Also, please note we varied the MACD indicator in the strategy by using a 20 period window instead of a 12 period window (for the short term average), and a 40 period window instead of a 26 period window (for the long term average), this modification helped to smoothen out erratic price changes.

Trading Based on the MACD in a bull market

In a crypto bull market, not selling prematurely is key to maximizing profits (i.e. missing out on a few days of 10%+ gains can set you back quite a bit — most crypto gains tend to be tail end gains (extreme gains) occurring within a short amount of time).

Below is the MACD strategy run from August 18 to Dec 31 of 2017. We set the buy trigger to whenever the MACD hits 0 or less, and the sell trigger to whenever the MACD hits 3 or more:

MACD Strategy run over Aug 18 2017 — Dec 31, 2017

Although the returns are impressive (+109.11%), it does not beat buying and holding eth (+149.69%) for the same period of time. Share link: https://www.cryzen.com/result/8186/494ab327-b521-454a-85e3-828e9fe4ecc9

As the MACD tends to spike pretty high (commensurate with radical price gains), it is hard to tell when exactly the MACD will top out (just like it is hard to tell when exactly the price has hit a maximum).

It is not inconceivable that there are parameters for this MACD strategy that can outperform buying and holding in a bull market. We leave it up to the user to play around with this strategy and solve this puzzle (if possible, and of course, without overfitting — something we will delve into deeply in the context of trading bots in a future article).

Get this strategy on Cryzen and play around with it!

You can access the strategy by signing up on cryzen.com, or via this share link: https://www.cryzen.com/result/8175/d7ec7e62-5977-447e-a899-f5e8d3052b03

Hit “Get this Strategy” to clone the strategy into your cryzen account and play around with it:

Deploy Live!

Feel free to play around with the buy and sell thresholds, and if you’re feeling bold, hit the “Deploy Strategy” button to run this on your binance account!

Tutorial for live deployment here:

Live Bot Deployment via Cryzen

Join the Conversation on Telegram: t.me/cryzen and sign up on Cryzen to stay up to date on new releases

Credits: Written by Shuvro Biswas, coFounder at Cryzen

Note: Abhijoy Sarkar (https://medium.com/@SarkarAbhijoy) is associated with and an active member of Cryzen, he has permissions to repost this on other sources.