Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 33

Introduction to MACD

Moving Average Convergence Divergence (MACD) is a trend-following momentum indicator


that shows the relationship between two moving averages of a stock’s price. MACD helps
investors understand whether the bullish or bearish movement in the price is strengthening or
weakening. Created by Gerald Appel, it is designed to reveal changes in the strength, direction,
momentum, and duration of a trend in a stock’s price.

The following are the topics of all the articles we will cover in our MasterClass on MACD:

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

In the Part – 1 of our MasterClass on MACD, we’ll be giving an in-depth introduction to what
MACD is and how to use it. We’ll be discussing the following topics in-depth with descriptions
on chart wherever necessary:

 Trend-Following Momentum Oscillator


 Exponential Moving Average
 MACD Line
 Convergence-Divergence Meaning
 Signal Line
 Histogram
 Use Cases

Calculation

The MACD indicator as a whole consists of the MACD Line, the Signal Line and the MACD
Histogram each with their own interpretations and uses. The following are the features and
calculations of the MACD indicator:

1. EMA – An exponential moving average (EMA) is a type of moving average (MA) that places a
greater weight and significance on the most recent data points.  An exponentially weighted moving
average reacts more significantly to recent price changes than a simple moving average (SMA), which
applies an equal weight to all observations in the period.
12-EMA in Green and 26-EMA in Red

2. MACD Line – MACD is calculated simply by subtracting the long-term EMA (26
periods) from the short-term EMA (12 periods). 

MACD=12-Period EMA − 26-Period EMA

Look how the MACD line moves above and below zero based on the difference of 9 and 12-
EMA

3. Signal Line –  A nine-day EMA of the MACD called the “signal line,” is then plotted on
top of the MACD line, which can function as a trigger for buy and sell signals. 

Signal Line = 9-Period EMA of MACD Line


Signal Line as 9-EMA of MACD Line

4. Histogram – MACD is often displayed with a histogram (see the chart below) which
graphs the distance between the MACD and its signal line. If the MACD is above the signal line,
the histogram will be above the MACD’s baseline. If the MACD is below its signal line, the
histogram will be below the MACD’s baseline. Traders use the MACD’s histogram to identify
when bullish or bearish momentum is high.

Histogram as the difference between MACD and Signal Line

Idea

The MACD turns two trend-following indicators (exponential moving averages) into a
momentum oscillator by subtracting the longer moving average from the shorter one. By default,
it is calculated by subtracting the 26-period Exponential Moving Average (EMA) from the 12-
period EMA. As a result, the MACD offers the best of both worlds: trend following and
momentum.

The MACD fluctuates above and below the zero line as the moving averages converge, cross and
diverge. Traders can look for signal line crossovers, centerline crossovers and divergences to
generate signals.

Parameters

There are 3 parameters associated with MACD. The look-back periods of shorter and longer
EMA to define the MACD Line form the first two parameters of MACD. The third parameter is
the look-back period of the EMA associated with the Signal Line. By default, a setting of (12,
26, 9) is used which means MACD Line is calculated as the difference of 12-EMA and 26-EMA
whereas Signal Line is calculated by taking 9-EMA of the MACD Line.

Convergence-Divergence

As the name implies, the MACD is all about the convergence and divergence of the two moving
averages. Convergence occurs when the moving averages move towards each
other. Divergence occurs when the moving averages move away from each other. 

The shorter moving average (12-EMA) is faster and more reactive to recent price changes. The
longer moving average (26-EMA) is slower and less reactive to price changes in the underlying
security. This means that when the 12-EMA is greater than the 26-EMA, recent prices are rising
and there’s a positive sentiment in the market. On the other hand, when the 12-EMA is smaller
than 26-EMA it means that the recent prices are falling and there’s a negative sentiment in the
market.

Positive MACD indicates that the 12-day EMA is above the 26-day EMA. Positive values
increase as the 12-EMA diverges further from the 26-EMA. This means upside momentum is
increasing. Negative MACD values indicate that the 12-day EMA is below the 26-day EMA.
Negative values increase as the 12-EMA diverges further below the 26-EMA. This means
downside momentum is increasing.

Use Cases

1. Centreline Crossover: The MACD line oscillates above and below the zero line, which is also
known as the centreline. These crossovers signal that the 12-day EMA has crossed the 26-day EMA. The
direction, of course, depends on the direction of the moving average cross. 

A bullish centreline crossover occurs when the MACD line moves above the zero line to turn positive i.e.
12-EMA crosses up 26-EMA. A bearish centreline crossover occurs when the MACD moves below the
zero line to turn negative. 

MACD Line crossing up and down the centreline (zero) according to price momentum changes

2. Signal Line Crossover: The signal line is a 9-day EMA of the MACD line which trails
the MACD and indicates the momentum changes in convergence-divergence. A bullish
crossover occurs when the MACD turns up and crosses above the signal line. A bearish
crossover occurs when the MACD turns down and crosses below the signal line.

Bearish Signal Line Crossover

3. MACD Divergence: A bullish divergence forms when a security records a lower low and
the MACD forms a higher low. The lower low in the security affirms the current downtrend, but
the higher low in the MACD shows less downside momentum. A bearish divergence forms when
a security records a higher high and the MACD line forms a lower high. The higher high in the
security is normal for an uptrend, but the lower high in the MACD shows less upside
momentum.
Bearish Divergence

Bullish Divergence
4. Histogram: The MACD Histogram is simply the difference between the MACD line and
the MACD signal line.When a stock, future, or currency pair is moving strongly in a direction,
the MACD histogram will increase in height. When the MACD histogram begins to shrink, the
market is slowing down and might be warning of a possible reversal.

Negative Histogram during Downtrend; Positive Histogram during Uptrend


There are a lot more complicated use cases of MACD using the above shown methods. In the next
article of our MACD MasterClass we’ll be talking about the Centreline Crossover strategy in a lot more
detail.

he Centreline Crossover Trading Strategy

Previously in the first article of our MasterClass on MACD, we talked about what MACD is and
how to use it while making trading strategies. Checkout the first article if you haven’t already. In
this article, we’ll be talking about the most basic centreline crossover trading strategy using the
MACD indicator to generate buy/sell signals. We’ll also be talking about stop-loss and false
signal filtering while implementing it on Mudrex. We’ll be discussing the following topics in-
depth with screenshots of Mudrex’s strategy canvas wherever necessary:

 Centreline Meaning
 Crossover Meaning
 Strategy Description
 False Signal Filtering
 Stop Loss Implementation
 Trade Analysis
Centreline

As mentioned in the previous article, MACD is the difference of a shorter and a longer
Exponential Moving Average. The 12-EMA is the shorter, more volatile moving average which
reacts to recent price changes. The 26-EMA on the other hand is the longer, smoother moving
average which does not change abruptly with high-frequency price changes.

This means that when the 12-EMA is greater than the 26-EMA, the recent prices are gaining
momentum and an uptrend can be foreseen. Whereas when the 12-EMA is smaller than the 26-
EMA, the recent prices are losing momentum and a downtrend is expected in the near future.
Now since the MACD line is the difference of 12-EMA and 26-EMA, the zero line can be
defined as the centreline and trades can be placed when MACD becomes positive or negative.

Crossover

The centreline divides the canvas into bullish and bearish regions. The MACD is positive (above
the centreline), it means that 12-EMA > 26-EMA and the market has a bullish sentiment. When
MACD is negative (below the centreline), 12-EMA < 26-EMA and the market has a bearish
sentiment.

 Bullish Centreline Crossovers:  When MACD crosses up the centreline, it is a bullish signal and
we can expect an uptrend in the near future.
 Bearish Centreline Crossovers:  When MACD crosses down the centreline, it is a bearish signal
and we can expect a downtrend in the near future.
The MACD will remain positive when there is a sustained uptrend. The MACD will remain
negative when there is a sustained downtrend.

Setting Up

We’ll be using the default look-back periods of 12 and 26 for the shorter and longer EMA.
However, you can change it as per your trade frequency and risk appetite. Traders can consider
using the setting MACD(5,42,5). When used on the daily chart, this sets the fast EMA to a
week’s worth of data, the slow EMA to two months’ worth of data. Other popular pairs are 24-52
and 34-89.

Buy and sell conditions are fairly straightforward-

 Buy when: MACD Line crosses up 0


 Sell when: MACD Line crosses down 0

Building on Mudrex

Indicator block for the buy condition of MACD crosses up 0 looks like this:

Indicator block for the sell condition of MACD crosses down 0 looks like this:
False Signal Filtering

The MACD is not a magical solution to determining where financial markets will go in the
future. Taking MACD signals on their own is a risky strategy. Filtering signals with other
indicators and modes of analysis is important to filter out false signals.

With respect to the MACD, when a bullish crossover (i.e., MACD line crosses above the signal
line) occurs, yet the security’s price declines, it is referred to as a “false positive”. When a
bearish crossover occurs (i.e., MACD line crosses below the signal line), yet the security’s price
increases, it is deemed a “false negative”.

Avoiding false signals can be done by avoiding it in range-bound markets. Other ways can be
using MACD with other technical indicators like RSI or Stochastic for a double confirmation of
the trend. However any downsides caused by a false signal can be taken care of by using stop-
losses and trailing stop-losses.

Stop Loss

With a stop-loss order, if a share price dips to a certain set level, the position will be
automatically sold at the current market price, to stem further losses. For example, if you placed
a bullish buy order at $500 using the above strategy, but the signal turns out to be a false positive
and the prices instead of rising, start falling. This is where with the help of a stop loss you can
minimize the downside. With a stop-loss of say 5%, a sell order will be placed automatically if
price falls beyond $475 booking a loss of 5% but hedging any further downsides.
Trailing Stop Loss

Traders can enhance the efficacy of a stop-loss by pairing it with a trailing stop, which is a trade
order where the stop-loss price isn’t fixed at a single, absolute dollar amount, but is rather set at a
certain percentage or dollar amount below the current market price. When the price increases, it
drags the trailing stop along with it. Then when the price finally stops rising, the new stop-loss
price remains at the level it was dragged to, thus automatically protecting an investor’s
downside, while locking in profits as the price reaches new highs.

Trailing Stop Loss Graph

For example, if your purchase price was $500 with a trailing stop loss of 4%, the immediate
effective stop-loss value will be at $480. Now if the market price climbs to 700 USD, your
trailing stop value will rise to $680. If now for some reason the price begins to fall beyond $680,
a sell order will be placed locking in profits so far, while hedging any further downsides.

In our strategy, we will be using a trailing stop-loss of 5% solely for experimental purposes. You
can choose your own values depending upon the market volatility and risk tolerance by
backtesting on Mudrex.
Overall strategy looks like this:

Trade Analysis

Look how a strategy buy signal was called when the MACD Line touched and crossed up the
centreline in the following trade:
A trailing stop order [marked as ‘L’ in the above graph] was called when the prices fell by more
than 5% of the peak price. If we had not used a stop-loss, the sell signal would’ve been generated
4-5 candlesticks later when the MACD line crossed below zero leaving behind the profits and
booking in more losses than the trailing stop order.

This is how important false signal filtering can be, when it comes to preventing losses due to
false signals. In the upcoming article of our MasterClass on MACD, we will be talking about the
signal line crossover strategy with other concepts like take profit and trailing take profit.

The Signal Line Crossover Trading Strategy

In the last article of our MasterClass on MACD, we talked about how to implement the
centreline crossover trading strategy on Mudrex. Checkout the last article if you haven’t already.
In this article, we’ll be talking about the signal line crossover trading strategy along with the
concept of take profit and trailing take profit. We’ll be discussing the following topics in-depth
with trading charts and screenshots of Mudrex’s strategy canvas wherever necessary:

 MACD Line
 Signal Line
 Crossover
 Strategy Description
 Take Profit Implementation
 Trade Analysis
MACD Line

As we talked about before, the MACD Line is the difference between the shorter and longer
period EMA. The mere value of the MACD line, positive or negative, can indicate the sentiment
of the market. Exponential Moving Averages (EMA) of “price” can be interpreted as defining
the trend of the market. Crossovers of MACD with the centreline can therefore tell us about
changes in price movements rather than trend reversals. 

Signal Line

To use the MACD indicator to detect trend reversal we need to consider the Exponential Moving
Average (EMA) of the “MACD Line” instead of the price as described above. The signal line is
a 9-day EMA of the MACD line. As a moving average of the indicator, it trails the MACD and
makes it easier to spot MACD turns. Changes in MACD line movements can hence be
interpreted for trend reversals and thus buy/sell signals can be generated at the crossovers of the
MACD line and the Signal line.

Parameters

The look-back periods of shorter and longer EMA to define the MACD Line can be set on
Mudrex. The third parameter is the look-back period of the EMA associated with the Signal
Line. By default, a setting of (12, 26, 9) is used which means MACD Line is calculated as the
difference of 12-EMA and 26-EMA whereas Signal Line is calculated by taking 9-EMA of the
MACD Line.

However, you can change it as per your trade frequency and risk appetite. Traders can consider
using the setting MACD(5,42,5). When used on the daily chart, this sets the fast EMA to a
week’s worth of data, the slow EMA to two months’ worth of data. Other popular pairs
are (24,52,9) and (34,89,34).

Setting Up

We will be using the default look-back periods of (12, 26, 9) for the sake of simplicity. MACD
line less than Signal line is an indication of an overall downtrend whereas MACD line greater
than the Signal line is an indication of an overall uptrend. When the MACD line crosses above
the Signal line, it means that a trend reversal from bearish to bullish can be anticipated. On the
other hand, when the MACD line crosses below the Signal line, a trend reversal from bullish to
bearish can be anticipated. Therefore the buy and sell signals can be generated as follows-

Buy when: MACD crosses up Signal [Bullish crossover]


Sell when: MACD crosses down Signal [Bearish crossover]
MACD Signal Line Crossovers

Building on Mudrex

Compare block for MACD crossing up Signal looks like this:

Compare block for MACD crossing down Signal looks like this:

Take Profit (TP)

With a take-profit order, if a share price rises to a certain set level, the position will be
automatically closed at the price of the take-profit order. Most traders use take-profit orders in
conjunction with stop-loss orders (SL) to manage their open positions. If the security rises to the
take-profit point, the TP order is executed and the position is closed for a gain. If the security
falls to the stop-loss point, the SL order is executed and the position is closed for a loss. The
difference between the market price and these two points helps define the trade’s risk-to-reward
ratio.
Trailing Take Profit (TTP)

Traders use a TP order only when they want satisfactory gains and are sure that the uncertainty
with the market price of the security will increase after a certain jump in price. The stock could
start to breakout higher, but the TP order might execute at the very beginning of the breakout,
resulting in high opportunity costs. To outmanoeuvre this opportunity cost, trailing take profit
can be used. The TTP is set as a trailing percentage on Mudrex, and if the price is breaking out
above the take profit limit, the TTP will trail the upward moving price and execute the trade only
when the price goes down by the set TTP percentage. All this is happening only after the price
breaks above the TP order thus booking in more profits than exiting at TP preemptively.

TTP
Example
In our strategy, we will be using a TP of 10%. This would mean that a long trade will exit as
soon as the price rises 10% above the buy price. Using a TTP of say 2% would mean that now
the trade will only exit once the price breaks above TP and then drops down by 2%. The values
set are solely for experimental purposes and you can choose your own values depending upon
the market volatility and risk tolerance by backtesting on Mudrex.
The overall strategy looks somewhat like this:

Overall
Strategy

Trade Analysis

The buy signal (B) shown in the chart above was generated when MACD crossed up Signal line
indicating a possible uptrend in the future. However, as soon as the price rose more than 10% of
the buy price, the TTP started trailing the price. At the red candlestick, when the price fell more
than 2% of the peak price, the TTP sell signal was generated (marked as P in the chart above).
With a suitable usage of stop-loss and take-profit combination, you can make the most use of
your designed trading strategy by minimizing risk and all this can be automatically done on
Mudrex. In the next article of our MACD MasterClass, we will be talking about a slightly
complex method of using MACD in multiple time-frames.

MACD Histogram in Multiple Time-Frames

In the last article of our MasterClass on MACD, we talked about how to implement the signal
line crossover trading strategy on Mudrex. Checkout the last article if you haven’t already. In
this article, we’ll be talking about how to use MACD in multiple time-frames on Mudrex. We’ll
be discussing the following topics in-depth with descriptions on trading charts and screenshots of
Mudrex’s strategy canvas wherever necessary:

 MACD Histogram
 Multiple Time-Frames
 Histogram Crossover
 Strategy Description
 Trade Analysis

MACD Histogram

The MACD-Histogram measures the distance between MACD and its signal line (the 9-day
EMA of MACD). Like MACD, the MACD-Histogram is also an oscillator that fluctuates above
and below the zero line. It was developed to anticipate signal line crossovers in MACD. Because
MACD uses moving averages and moving averages lag price, signal line crossovers can come
late and affect the reward-to-risk ratio of a trade.

MACD Histogram: MACD - Signal Line


Since the Signal Line is the EMA of the MACD line, it lags the value of MACD. Therefore,
when MACD > Signal Line, the market has an overall positive sentiment. When MACD < Signal
Line, the market has an overall negative sentiment. Thus when MACD Histogram is positive,
bullishness is anticipated. When MACD Histogram is negative, bearishness can be anticipated.

The histogram is positive when MACD is above its signal line. Positive values increase as
MACD diverges further from its signal line (to the upside) and decrease as MACD and its signal
line converge. The MACD-Histogram crosses the zero line as MACD crosses below its signal
line. The indicator is negative when MACD is below its signal line. Negative values increase as
MACD diverges further from its signal line (to the downside). Conversely, negative values
decrease as MACD converges on its signal line.
MACD Histogram
as the difference of MACD Line and Signal Line

Multiple Time-Frames

If you are a short-term trader you might be focusing on short-term charts and trends. If you are a
long-term trader you might be focusing on long-term charts and trends. However, when the
short-term and long-term trends are in agreement you are probably right to be confident about a
trade. This is the level of importance of using multiple time-frames to generate buy and sell
signals.

We’ll be using a higher time-frame “trend chart” to define a predominant uptrend or a downtrend
using MACD Histogram while a volatile lower time-frame “signal chart” to generate buy/sell
signals using Signal Line Crossovers. By now it might be clear as to why we always use a higher
time-frame or look-back period for setting a trend whereas a smaller time-frame or look-back
period to generate buy/sell signals.

The following pairs of time-frames can be used to define your own trend/signal charts:

Trend Chart (Predominant) Signal Chart (Volatile)


15 to 30-minute 1-minute

1-hour 5-minute

4-hour 15 to 30-minute

1-day 1-hour

1-week 1-day

1-month 1-week

Multiple Time-Frames Values


Setting Up

We’ve talked about False Signal Filtering in the Part-2 of our MACD MasterClass. In this case,
we’ll be using a higher time-frame MACD Histogram to determine the overall trend of the
market. This will help filter the false signals while using the Signal Line Crossovers to generate
the buy/sell signals in a smaller time-frame. 

In a higher time-frame [T1], if MACD Histogram is positive, the market is in an uptrend and we
can start looking for buying opportunities in the lower time-frame [T2] signal line crossovers.
Similarly, If the MACD Histogram in the higher time-frame is negative, the market is in a
downtrend and we can look for selling opportunities in the lower time-frame.

Hence the following buy/sell signals can be generated:

Buy when:

1. MACD Histogram > 0 [T1]


2. MACD crosses up Signal Line [T2]

Sell when:

1. MACD Histogram < 0 [T1]


2. MACD crosses down Signal Line [T2]
MACD Histogram
Crossovers
 Building on Mudrex

We’ll be using the MACD indicator in it’s default settings of (12, 26, 9). We’ll use a higher
time-frame of 1D whereas a lower time-frame of 1H. However you can use your own pair from
the aforementioned table. Also note that the MACD Histogram is by the name of “Difference” in
the indicator blocks on Mudrex.

Indicator block for the first buy condition of  MACD Histogram > 0 [T1] is as follows. Notice
the “tick interval” in the advanced parameter dropdown is set as T1:
Compare block for the second buy condition of MACD crosses up Signal Line [T2] is as follows.
Notice the “tick interval” in the advanced parameter dropdown is set as T2:
Actual values of T1 and T2 (1H and 1D) are set while performing a backtest.

Joining the two blocks using an AND block to generate a buy signal:

Similarly, a sell signal can be generated from the conditions defined above. The overall strategy
looks somewhat like this:
Overall
Strategy

Trade Analysis

Setting T1 as 1H and T2 as 1D in the backtest settings:

Setting
values of T1 and T2

This means that the overall trend will be set using the daily charts whereas the signals will be
generated at local tops and bottoms in the hourly chart.

Running a backtest over the past 9 months gives us pretty decent results with a Sharpe
Ratio of 1.87 whereas a Win Ratio of a whopping 100 which means all 5 trades ended up in
profits.
9 month
backtest performed from 7th Sept 2019 to 7th June 2019 on Bitmex BTC/USD

Analysing the most recent trade in a 1D trend chart, look how the buy signal was generated while
the Histogram was greater than zero whereas the sell signal was generated when the histogram
became lesser than zero.

Trade
Analysis on Trend Chart with 1D Time-Frame

Analysing the same trade for signal line crossovers in a 1H signal chart, the buy signal was
generated at a bullish crossover of MACD and Signal whereas the sell signal was generated at a
bearish crossover of MACD and Signal:
Trade
Analysis on Signal Chart with 1H Time-Frame

The fact that there were minimum/none false signals generated shows how beautifully we
filtered the false signals using MACD Histogram in multiple time-frames to determine the
overall trend first and then generate the buy/sell signals. False signals can also be filtered by
stop-losses however by booking in small losses. 

One interesting thing here is that the Signal Line crossover can be replaced by MACD Histogram
in a lower time-frame because essentially the Histogram is the difference of MACD and Signal
and thus zero-line crossover of the Histogram is the same as signal line crossover. In the next
article of our MACD MasterClass, we will be talking about a very popular Double Cross Trading
Strategy using the two most compatible indicators, MACD and Stochastic.

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 standardisation 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 2nd 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.

You might also like