The Moving Average Convergence/Divergence (MACD) indicator is a momentum indicator. It tries to show the trend of the underlying price. The MACD is computed using 2 exponential moving averages (EMA), with a third EMA used to signal buy/sell conditions. The MACD is computed by subtracting a longer EMA (e.g. 26 periods) from a shorter EMA (e.g. 12 periods). Then, an even shorter EMA (e.g. 9 periods) of the MACD itself, called the “signal line”, is used to identify buy/sell signals. When the MACD rises above the signal line, this indicates upward momentum, which creates a buy signal (shown as green on the histogram in the figure below). Conversely, when the MACD falls below the signal line, this indicates downward momentum, which creates a sell signal (shown as red on the histogram in the figure below).
Example parameter values
Time Resolution: 1 hour
EMA Length (Long): 26
EMA Length (Short): 12
EMA Length (Signal): 9
Buy/Sell Threshold: 0
- Time Resolution: The time resolution the indicator will use to analyze the market. For example, if this is chosen as 1 hour, and the EMA Length is 26, then the indicator will use 26 1-hour periods in the exponential moving average. If it is instead chosen as 1 minute, then the indicator will use a 26 1-minute periods in the exponential moving average.
- EMA Length (Long): used to compute the MACD.
- EMA Length (Short): used to compute the MACD.
- EMA Length (Signal): used to compute the signal line from the MACD.
- Threshold: The “Threshold” parameter allows the user to gauge the strength of the momentum. If Threshold is set to 0, then when the MACD is above the signal line, that is a buy signal, and vice versa. However, if this parameter is set to 0.2, then a buy signal will be generated when the MACD is 0.2 above the signal line (or further above the signal line), and a sell signal will be generated when the MACD is 0.2 below the signal line (or further below the signal line). Increasing this parameter can affect the strength of the momentum that indicates a buy/sell signal.