MACD Strategy

Description

MACD Strategy is a strategy build to gain profit on alternately buying and selling shares. MACD Strategy calculates two lines of values:

  • MACD line - difference between the n-period EMA and the k-period EMA

\text{MACD} = EMA_{n} - EMA_{k}, k > n

\text{EMA}_{m} - \text{exponential moving average of m periods.}

  • Signal line - The l-period EMA of the MACD

\text{Signal Line} = EMA_l(MACD)

In the moment when the MACD line crosses below MACD Signal line then it is a signal to sell shares and respectively when it crosses above MACD Signal line it is a time to buy shares.

Market Data

  • Last trade

Parameters

Parameter name Description Essential
Length of Short-term Average Number of last ‘last trades’ events used to compute short-term EMA for MACD Yes
Length of Long-term Average Number of last ‘last trades’ events used to compute long-term EMA for MACD Yes
Length of MACD Signal Line Number of last values of MACD line used to compute value of MACD signal line Yes

Conditions

Open position

Side Buy
Amount One asset per order
Price Last market price
Type Price limit

(\text{MACD}_{i} - \text{Signal line}_{i} > 0)  \wedge (\text{MACD}_{i-1} - \text{Signal line}_{i-1} < 0)

i - \text{point in time}

If MACD line crosses above Signal line then it is a signal to buy.

Close position

Side Sell
Amount One asset per order
Price Last market price
Type Price limit

(\text{MACD}_{i} - \text{Signal line}_{i} < 0)  \wedge (\text{MACD}_{i-1} - \text{Signal line}_{i-1} > 0)

i - \text{point in time}

If MACD line crosses below Signal line then it is a signal to sell.

Termination

There is no strategy termination condition.

Time frame

Strategy bases on two lines which are functions of some number (equal to number of periods) of prices. Frequency of new positions depends on the price values, EMA calculations and the number of periods.

Further information & source

PLEASE NOTE: Empirica does not provide tax, investment, or financial services. The information available through this website is provided on an "as is" basis at user's sole risk and does not constitute trading advice or a solicitation to buy or sell any stock, option, future, commodity, or forex product. Empirica makes no guarantees as to the accurateness, quality, or completeness of the information and shall not be responsible or liable for any errors, omissions, inaccuracies in the information or for any user's reliance on the information. User is solely responsible for verifying the information as being appropriate for user's personal use, including without limitation, seeking the advice of a qualified professional regarding any specific financial questions a user may have. Past performance is not necessarily an indication of future performance. Trading is inherently risky.