MACDLine

Category: Indicators

The MACDLine function in ProBuilder language is used to calculate the Moving Average Convergence Divergence (MACD) line, which is a trend-following momentum indicator. The MACD line itself is the difference between two exponential moving averages (EMAs) of the price, typically over short and long periods. This function is crucial for identifying potential changes in market momentum and direction.

Syntax:

MACDLine[S,L,Si](price)

Where:

  • S is the short period EMA.
  • L is the long period EMA.
  • Si is the signal line period, which is used to smooth the MACD line.
  • price refers to the price series used (e.g., close, open).

Example:

i1 = MACD[12,26,9](close)
i2 = MACDLine[12,26,9](close)
if(i1 < i2 AND i1[1] > i2[1]) THEN
bullishSignal = 1
bearishSignal = 0
ELSIF (i1 > i2 AND i1[1] < i2[1]) THEN
bullishSignal = 0
bearishSignal = -1
ELSE
bullishSignal = 0
bearishSignal = 0
ENDIF
RETURN bullishSignal, bearishSignal

This example demonstrates how to use the MACDLine function to generate trading signals. The code compares the MACD line (i2) with the MACD histogram (i1) to detect bullish and bearish crossovers. A bullish signal is set when the MACD line crosses above the histogram, and a bearish signal is set when it crosses below.

Additional Information:

  • The MACD line is widely used in technical analysis to gauge the strength, direction, and momentum of a stock price trend.
  • Understanding the behavior of the MACD line in relation to its signal line and the histogram can provide insights into potential buy or sell opportunities.

Related Instructions:

  • DivergenceMACD indicators
  • MACD indicators
  • MACDsignal indicators
  • Logo Logo
    Loading...