All indicators

MACD of Linear Regression Slope Indicator

Oct 2, 2018

Static chart image
SignalsOscillatorsMoving Averages

The MACD of Linear Regression Slope Indicator tool aims to identify peak and trough points in market trends by applying the Moving Average Convergence Divergence (MACD) formula directly to a Linear Regression Slope calculation. By combining these two mathematical approaches, the script provides a momentum-based perspective on the underlying trend's rate of change, helping traders identify potential reversals or exhaustion points.

Usage

The indicator can be used to gauge the strength and direction of a trend's slope. When the MACD line (blue) is above the signal line (red), it suggests increasing upward momentum in the regression slope. Conversely, when the MACD line falls below the signal line, it indicates weakening momentum or a potential downward shift in the trend's angle.

The histogram (delta) serves as a visual guide for these crossovers:

  • Green Columns: Indicate that the MACD line is above the signal line, signaling bullish momentum in the slope.
  • Red Columns: Indicate that the MACD line is below the signal line, signaling bearish momentum in the slope.

Traders often look for peaks and troughs in the MACD line itself to anticipate when a linear trend might be overextended and due for a correction.

Details

The script first calculates a Linear Regression Curve (LRC) based on a user-defined length. This LRC value is then used as the source for the MACD calculation instead of the standard price input. The MACD is derived by subtracting a Slow Exponential Moving Average (EMA) from a Fast EMA of the LRC. A signal line (an EMA of the resulting MACD) is then plotted to provide crossover signals. This implementation shifts the focus from price momentum to "trend momentum," filtering out minor price fluctuations to highlight shifts in the broader directional slope.

Settings

  • Length of LRC: Determines the lookback period for the Linear Regression calculation. Higher values result in a smoother trend representation.
  • Fast Length: The period for the shorter Exponential Moving Average used in the MACD calculation.
  • Slow Length: The period for the longer Exponential Moving Average used in the MACD calculation.
  • Signal Length: The smoothing period for the MACD's signal line.

FAQ

How do I interpret the histogram?

The histogram represents the difference (delta) between the MACD line and the signal line. Green bars appear when the MACD is above the signal line, while red bars appear when it is below.

What is the advantage of using Linear Regression as a source?

Using Linear Regression instead of raw price helps to smooth out market noise and focus on the mathematical "best fit" line of the price action, making momentum shifts in the trend easier to spot.

How can I access this indicator?

You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

Free indicator

Get free access to this indicator on the platforms below.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.