MACD MasterClass — Part 5

Kshitiz Khandelwal
Mudrex
Published in
6 min readJun 8, 2020

The Double-Cross Trading Strategy

In the last 4 parts of our MACD MasterClass, we’ve been talking about all the fundamental ways of using MACD indicator on Mudrex. Checkout the last article if you haven’t already. In this article, we’ll be talking about a very popular Double-Cross Trading Strategy using MACD and Stochastic Indicator. We’ll be discussing the following topics in-depth with descriptions on trading charts and screenshots of Mudrex’s strategy canvas wherever necessary:

Idea

When technical analysts talk about the two most compatible and easy to use indicators, the first thought which comes to their mind is the Moving Average Convergence-Divergence (MACD) and the Stochastic Indicator. The analysts believe that this combination works because the stochastic is comparing a stock’s closing price to its price range over a certain period of time, while the MACD is the formation of two moving averages diverging from and converging with each other. If used to its fullest potential this active amalgamation is extremely effective in the right time-frame.

Stochastic Indicator

A stochastic oscillator is a momentum indicator comparing a particular closing price of a security to a range of its prices over a certain period of time. Just like MACD, stochastic also has a faster moving metric and a slower moving metric.

The following is the formula for calculating the slow-stochastic indicator called %K:

where

C = Most recent closing price
L14 = Lowest price traded in past 14 trading sessions
H14 = Highest price traded in the past 14 trading sessions
%K = Current value of the stochastic indicator

The fast-stochastic indicator is taken as %D = 3-period moving average of %K.

The general theory serving as the foundation for this indicator is that in a market trending upward, prices will close near the high, and in a market trending downward, prices close near the low. And hence in a range of 0–100, 80+ is considered as overbought indicating an upcoming downtrend while 20- is considered to be oversold indicating an upcoming uptrend. Buy/sell signals can be generated using the crossovers of %K and %D but we’ll be using the overbought and oversold thresholds for our strategy.

Setting Up

For the sake of standardization and simplicity, we’ll be using the default look-back periods for both MACD and Stochastic. We’ll use the difference of 12-period EMA and 26-period EMA in case of MACD to set the predominant trend and threshold values of 20 and 80 of the 14-period stochastic indicator to generate buy/sell signals.

Defining a Bullish Scenario

1. Predominant uptrend is confirmed when MACD is positive which means 12-period EMA > 26-period EMA which is a sign of strength

2. Enter the trade as soon as the stochastic indicator dips below 20 and rises again so that we enter right at the bottom of the upcoming uptrend thus maximizing profits

Defining a Bearish Scenario

1. Predominant downtrend is confirmed when MACD is negative which means 12-period EMA < 26-period EMA which is a sign of weakness

2. Exit the trade as soon as the stochastic indicator soars above 80 and comes down so that we exit the trade right at the top of the upcoming downtrend thus maximizing profits

Look at the Buy and Sell signals generated according to the conditions defined above

Building on Mudrex

Say no to manually setting up your trades by making your auto-trading bot within minutes on Mudrex. The Mudrex platform helps traders automate their trading and hence helps you execute your trading without any hassle! You can create strategies on Mudrex using simple blocks. You can connect multiple blocks and define conditions on those connections or paths to create your strategy on Mudrex.

As discussed above, let us first write our entry/exit conditions so that we know what to do while building our strategy:

Buy when:

  • MACD > 0
  • %K crosses up 20

Sell when:

  • MACD < 0
  • %K crosses down 80

We’ll use a stop loss of 10% to prevent losses due to any false signals generated. Stop loss helps improve the percentage of trades won, by a good margin. Choosing the value of stop loss depends on how much risk you’re willing to take and how volatile the market is.

The strategy looks pretty intuitive and can be easily constructed by using a couple of indicator blocks as follows. We’ll use the MACD indicator block to make the first buy condition MACD > 0:

To make the second buy condition, we set the %K output crossing up 20 in the stochastic oscillator block:

Connecting the two using an “AND” block to generate the buy signal:

Similarly, creating a sell signal by defining MACD < 0 and %K crossing down 80 is left as an exercise.

Set up a stop loss of 10% by clicking the stop loss tab on the left panel:

The overall strategy with sell signal and stop loss looks like this:

Overall Strategy

This is how easy it is to build your own profit-generating strategies on Mudrex within minutes!

We can now run a quick back-test to see how our strategy performs. Running one from over the past 3 months using a tick cycle of 2H gives us pretty convincing results doubling our returns with a Sharpe Ratio of 2.81 and a win ratio of 2/3rd:

Backtest using a 2H tick cycle on Bitmex BTC/USD

The advantage of this strategy is it gives traders an opportunity to hold out for a better entry point on up-trending stock or to be sure any downtrend is truly reversing itself when bottom-fishing for long-term holds. Because the stock generally takes a longer time to line up in the best buying position, the actual trading of the stock occurs less frequently, so you may need a larger basket of stocks to watch. You may also want to add a relative strength index ( RSI) indicator into the mix, or make use of the signal line of MACD or %D line of the stochastic indicator to generate buy/sell signals.

Checkout the rest of the articles if you haven’t already:

Part 1: Introduction to MACD
Part 2: Centreline Crossover Strategy
Part 3: Signal Line Crossover Strategy
Part 4: MACD Histogram in Multiple Time-Frames
Part 5: MACD with Stochastic Indicator

With this, we come to the end of our MasterClass on MACD. By now, you should have a firm hold of the various concepts related to trading using MACD. The methods discussed in this MasterClass can be easily combined with other compatible indicators to generate innumerable profitable trading strategies on Mudrex. See you during the next MasterClass!

Stay tuned!

Links

A few quick references below:

· Signup now on Mudex and get $25 FREE: https://mudrex.com/signup
· Support and FAQs: https://support.mudrex.com/hc/en-us
· 24*7 support on our Discord channel: https://discord.gg/huZz3qP

Happy Trading!

Originally published at https://blog.mudrex.com on June 8, 2020.

--

--