Long on crypto? This MACD strategy does it better!

Kirill Kanshin
4 min readJan 22, 2019

--

A simple trading strategy that consistently beats the cryptocurrency market.

2018 was a rough year for crypto enthusiasts. Following the hype of 2017 the total crypto market cap as of today has a drawdown of more than 85% in comparison to its peak of $829 bln reached at the beginning of 2018. The hype cycle is a known phenomenon; the previous growth rates were astonishing, but at the same time unsustainable.

Nonetheless, what does not kill us makes us stronger, and this applies to the cryptocurrency world as well. We are now entering into a stable, moderate growth regime.

The market is maturing and many exciting innovations are coming such as the Constantinople (re-)fork of Ethereum blockchain — one more step towards the transition to proof of stake and more.

This is why more and more people are deeply convinced that keeping some part of their portfolio in crypto is a smart choice nowadays. Buy the dip!

In this article, I will share with you one trading strategy that significantly outperforms holding of crypto (Ethereum in this case) over the last 6 months. It is backtested using the Enigma Catalyst trading engine and it is readily implemented in the Cryzen Trading Platform, free to use for everyone, starting from January 31st. Go and check it out! First, I will describe the logic and parameters of the algorithm, then provide the backtesting results.

The Strategy

To determine entry and exit points the simple MACD indicator is used. It is readily available in the TA-lib python library. Though the MACD strategy is described literally on every single website dedicated to trading, the devil is in the details. What parameters to choose? What candles to trade on: minute, hours, days? That is a huge parameter space to study, but don’t worry, I got you covered.

We will use 1H candlestick data for the ETH/USDT pair on Binance. The moving averages are calculated over the following number of 1-hour periods (see Investopedia for definitions and more details about how the MACD is calculated)

SYMBOLNAME = 'eth_usdt'
BARS_FREQ = '1H'
MACD_FAST = 12
MACD_SLOW = 26
MACD_SIGNAL = 9

MACD calculation results in 3 lines — macd, macdSignal, and their difference macdHist. We will use macdHist (MACD Histogram line) to determine buy and sell conditions as follows:

  • Buy when macdHist > BUY_TRIGGER
  • Sell when macdHist < SELL_TRIGGER with
BUY_TRIGGER = 0.1
SELL_TRIGGER = 0.05

The strategy is good to go now, but we will add two more features to boost the performance even further.

First, in order to confirm a bullish trend and not to jump on it too quickly, we will count how many minutes macdHist has been above our buy trigger value and enter the trade only when this count is greater than BULLCOUNT parameter. The optimal setting is

BULLCOUNT = 2 #minutes

Second, sometimes macdHist fluctuates around trigger values without definite direction, thus causing a chain of repeating buys and sells with losses due to commissions. To prevent this, let’s introduce COOLDOWN — the number of minutes that algorithm sleeps after completing a roundtrip (buy/sell cycle). This parameter is very important and it does affect the outcome significantly. A good value is

COOLDOWN = 60 * 5 #minutes

That’s it! Simple!

Backtest results

To give you an impression of its performance, here is the buy/sell plot for the current month — January 2019 (each candle corresponds to 1 minute).

Jan 1st — Jan 20th algorithm performance, 5% return.

The algorithm had 16 round trips, about one roundtrip per day. It made almost 5% over 20 days on a falling market and beat it by more than 15%! Isn’t it great?!

Performance summary over the last 6 months

The performance over the previous 6 months is impressive too. It repeatedly beats the market performance with the only exception of October 2018, where the market performed slightly better. Other than that it would have either saved some part of your money from burning or, in case of market growth, multiplied them even more!

This strategy along with a few others will be readily available at Cryzen, feel free to tweak its parameters, backtest it on different cryptocurrency pairs and launch it for live trading!

--

--