31.07.2021 Views

Ultimate Algorithmic Trading System

Using automated systems for trading in stock markets

Using automated systems for trading in stock markets

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

We will discuss moving averages in the last part of this chapter, but a little

knowledge of averages is necessary to fully grasp the MACD. A trend change is

usually indicated when a shorter (more sensitive) average crosses above/below

a longer (less sensitive) average. Unfortunately, moving average crossovers lag

current market conditions, and here is where the real beauty of the MACD is

revealed. The histogram component can quickly reveal when the difference between

the two moving averages (MACD) and the smoothed version of MACD (trigger)

is converging or diverging. Convergence means the MACD line and its associated

trigger are coming together and divergence means simply the two are growing apart.

As prices of an instrument increase, the short-term moving average will grow quicker

than a longer-term average. The MACD histogram will reflect this momentum. As

prices start to slow, the histogram will start moving in the opposite direction.

Calculation of MACD using 12-day and 26-day moving averages:

1. Calculate a 12-period EMA of price for the chosen time period.

2. Calculate a 26-period EMA of price for the chosen time period.

3. Subtract the 26-period EMA from the 12-period EMA.

4. Calculate a 9-period EMA of the result obtained from step 3.

This 9-period EMA line is overlaid on a histogram that is created by subtracting

the 9-period EMA from the result in step 3, which is called the MACD line, but it

is not always visibly plotted on the MACD representation on a chart.

A trading algorithm can be derived by waiting for the histogram to form a two-bar

high pivot (two bars to the left and to the right are shorter than the center bar) and

then entering a short position. Momentum has been positive but it is beginning to

slow. A long position can be initiated when a two-bar pivot low is formed in the

MACD histogram. Figure 2.12 shows how the pivot points in the histogram can

initiate trade signals.

55

STOCHASTICS AND AVERAGES AND RSI! OH, MY!

FIGURE 2.12

Histogram pivot points can initiate trade signals.

www.rasabourse.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!