Profitable Crypto trading strategies part 7: Macd 1.0

CryptoPredicted
Coinmonks
Published in
7 min readMay 17, 2018

--

MACD stands for Moving Average Convergence Divergence, it’s nothing more than an over-complicated name for a basic indicator. The Macd indicator simply shows the relationship between two different moving averages (simple or exponential ones). In this post I will analyze and discuss our first Macd based trading strategy.

MACD explained

If you don’t know or understand the Macd indicator then have a look at the candlestick chart above. The upper chart is the daily BTC-USDT chart, the lower plot is the Macd indicator. The indicator consists of three components: the purple and yellow lines are two different moving averages. When we subtract the yellow line from the purple we obtain the red/green bars (bar plot). Values greater than zero are indicated by green bars and the negative are red. That’s all there is to it.

Also Read: Best Crypto Trading Bots

MACD trading strategy

How can you use it to trade then? Macd is a pretty useful indicator that has some surprisingly interesting properties. One can invent several trading strategies, but here’s one of them: when there is a transition from red to green; this indicates a “buy” signal. But to sell it’s less evident, using the green to red transition may leave you with low success rates. So instead aim for making a 1% or 2% ROI, thus selling whenever you reach a certain ROI.

Another more theoretical strategy: try to detect the lowest (red) point on the bar plot to buy; then sell at the highest (green) point. Unfortunately we cannot know for sure whether the “current” value is the lowest (or highest) point and involves a lot of guesswork. Machine learning and AI on the other hand can do a much better job at determining the probability of some “current” value being the highest or lowest point, but this is a topic for another time.

MACD 1.0

Our Macd trading strategy is slightly more sophisticated than the one I explained above. Without going into the details, let us look at how it performs against the market. In the backtesting results below I’ve computed the ROIs based on 3 different markets: BTC, ETH and LTC (in USDT) using 60min intervals over 30 days.

The plot below shows the LTC-USDT market with our generated signals, from 2 April until 2 May. The ROI by these signal is exactly 20.26%, which is about 0.66% per day.

Macd 1.0 on LTC-USDT (2 April to 2 May)

On the next chart we see the ETH-USDT market with the buy/sell signals — yielding an ROI of 12.44%.

Macd 1.0 on ETH-USDT (2 April to 2 May)

And finally the BTC-USDT chart with an ROI of 16.64%.

Macd 1.0 on BTC-USDT (2 April to 2 May)

It’s important to note that the exact ROI value is less important than the bigger picture. That is, Macd 1.0 performs better for LTC than for ETH and BTC. The reason why is not very evident, and a lot has to do with the shape of the market and the timing of the buy/sell signals (i.e. luck).

Our Macd algorithm has 5 different hyper-parameters which we can optimize. But doing that will require hundreds of thousands of computations, which will take many hours (or days) to complete. This means one thing: the ROI can always be optimized, but since the market is always changing, the most optimal “general” hyper-parameters do not exist — thus it’s not worth the effort, since we’ll be playing a game of catch that we cannot win.

The shape of the market

I’ve mentioned several times already that the shape of the market matters a heck of a lot. Our trading algorithms are nothing more than programmed heuristics, and right now they are still early stage (i.e. dumb machines).

To illustrate this, let us backtest the Macd 1.0 strategy on a different set of recent data. The chart below shows the LTC-USDT market and our buy/sell signals from 17 April to 17 May. The ROI of these signals resulted in a negative -8.61%.

Macd 1.0 on LTC-USDT (17 April to 17 May)

Next up is ETH-USDT, yielding a negative ROI of -3.23%.

Macd 1.0 on ETH-USDT (17 April to 17 May)

And finally BTC-USDT, resulting in a negative ROI of -4.38%.

Macd 1.0 on BTC-USDT (17 April to 17 May)

Why is it that these ROIs are all negative?

The state and shape of the market matters a lot. Until May 6 the markets were in up-trend but then the prices started going down aggressively. The markets changed but the algorithm(s) remained the same, they keep generating the buy/sell signals as they were instructed (i.e. programmed) to do.

Does this mean you can’t make money in down-trend periods?

No, but it’s much riskier to trade during these periods, the proof is in the numbers. I notice that even during down-trend periods there are a ton of opportunities to cash out on.

On the candlestick chart below I’ve indicated very lucrative periods where you can aim to buy at a valley and sell at the peak. This again requires some guesswork as it’s pretty hard to know for sure if the “current” is at a valley, so it’s a risk you have to be willing to take.

Timing matters

Alternatively, I also mentioned that there is some luck involved (i.e. the timing of the buy/sell signals). For instance, two people can follow the same signals for 30 days, and one of them will end up making 10% ROI while the other one will hit break-even (0%) or worse. I actually saw this happen earlier today.

On our (newly upcoming) app people are able to look at the buy/sell signals for any given strategy. Over the past 30 days the Macd 1.0 (at 30min intervals) for LTC-USDT generated the signals as shown on the image below, yielding an ROI of 10.90%.

App: LTC-USDT Macd 1.0 signals (OHLC plot)

If I run the exact same simulation in my other backtesting framework (image below) I get an average ROI of -0.80%.

Backtesting: LTC-USDT Macd 1.0 signals (one of the many runs)

Why is it that the same strategy, the same market shape and state result in extremely different ROIs? Why is one positive (10%) the other one negative (-0.80%)? It has all to do with timing.

A buy/sell occurs when the price passes a certain threshold and meets certain criteria. Since neither of our system are analyzing the price in real-time, a window of opportunity is sometimes missed, as a result no buy/sell occurs. The app algo follows the price with a 10 to 20 second delay, while the backtesting framework takes a random price from the [Low, High] range.

Our backtesting framework runs one hundred simulations, computes their ROIs and spits out the average value (which is -0.80%). But it also gives the standard deviation which is 6.43%. This means that in reality, for most people (68%) who’ll be following these signals will end up earning an ROI between [-7.23% and 7.23%], during these 30 days (i.e. state of the market) that is.

The ROI from our app is almost two standard deviations away from the mean, making it an exception — but it’s a good exception. On average it is notifying us really well, the timing is exceptionally well.

Conclusion

All our trading strategies will need to be reworked and improved to cope with down-trend periods. Either I’ll have to make them stop trading when a down-trend period is detected or have the system adjust its own hyper-parameters in function of the state of the market. The latter approach would be quite experimental but might turn out to be an exciting adventure.

I hope you enjoyed the analysis, make sure to stay tuned for the next part.
- Ilya Nevolin

Also, Read

--

--

CryptoPredicted
Coinmonks

Cryptocurrency price predictions using machine learning, development and analysis of algorithmic trading strategies and more. App: https://cryptopredicted.com/