MACD

Obviously there are various methods of generating trend-following trading systems with MACD. This section shows one of the simplest applications of a stop-and-reverse MACD trend-following system based on MACD crossing the MACD's signal line and the signal line crossing the zero level. Readers are strongly encouraged to view this rudimentary system as a prototype in developing their own strategies.

Using CQG, the programming code for a simple MACD stop and reverse trading system is written in this way:

Long Entry and Short Exit:

MACD(@,13.000,26.000)[-1] XABOVE MACDA(@,13.000,26.000,9.000)[-1]
AND MACDA(@,13.000,26.000,9.000)[-1] > 0

Short Entry and Long Exit:

MACD(@,13.000,26.000)[-1] XBELOW MACDA(@,13.000,26.000,9.000) [-1]
AND MACDA(@,13.000,26.000,9.000)[-1] < 0

TABLE 3.6 MACD.

images

Table 3.6 presents the backtested portfolio results from December 31, 1992, to December 31, 2002, for this system.

Although these results are mildly encouraging, most people do not have the patience and fortitude to sit with a trade for an average of 143 days, and doing so is an absolute prerequisite for successful implementation of this particular system. Obviously various filters could be introduced to modify this characteristic; however, it is highlighted here to illustrate considerations in trading a system beyond mere analysis of risk versus return on investment or total net profit.

Get Mechanical Trading Systems: Pairing Trader Psychology with Technical Analysis now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.