Linear Regression Slope

Parameters: period = 14 (2–200)

Overview

The Linear Regression Slope indicator transforms the concept of trend analysis into a powerful momentum oscillator by calculating the slope coefficient of a best-fit regression line. This mathematical approach provides traders with an unbounded indicator that directly measures the rate of price change, making it superior to traditional momentum indicators for identifying trend strength. The slope calculation uses the formula: Slope = (N * Σ(xy) - Σx * Σy) / (N * Σ(x²) - (Σx)²), where the result represents the average price change per period. A positive slope indicates upward momentum, while a negative slope signals downward pressure, with the magnitude revealing the trend's intensity.

What sets the Linear Regression Slope apart is its dual ability to act as both a trend direction indicator and a momentum oscillator without the limitations of bounded indicators like RSI or Stochastic. The slope value provides immediate insight into market dynamics - steeper positive slopes indicate accelerating uptrends, while increasingly negative slopes warn of intensifying downtrends. When the slope flattens near zero, it signals potential trend exhaustion or consolidation phases. This characteristic makes it particularly valuable for timing entries and exits, as changes in slope direction often precede actual price reversals. The indicator's responsiveness can be fine-tuned through the period parameter, with shorter periods capturing rapid momentum shifts suitable for day trading, while longer periods smooth out noise for position trading strategies.

Interpretation & Trading Signals

Trend Direction & Strength:

  • Positive Slope: Uptrend confirmed, higher values = stronger trend
  • Negative Slope: Downtrend confirmed, lower values = stronger trend
  • Near Zero: No trend, consolidation or potential reversal
  • Slope Changes: Early warning of momentum shifts

Trading Strategies:

  • Zero-Line Cross: Buy when slope crosses above zero, sell below
  • Momentum Trading: Enter positions when slope accelerates
  • Divergence Trading: Fade moves when price/slope diverge
  • Trend Exhaustion: Exit when slope flattens from extremes

Advanced Applications:

  • Multi-Timeframe: Compare slopes across timeframes for confluence
  • Filter Trades: Only trade in direction of positive/negative slope
  • Risk Management: Reduce position size when slope weakens
  • Combine Indicators: Use with RSI/MACD for confirmation

Example Usage

Code examples will be available once the Rust implementation is complete.

Performance Analysis

Related Indicators