All indicators

Linear Regression [Anchored, Band, Signals]

Mar 10, 2026

Static chart image
Support and ResistanceSignalsChannelsVolatility

The Linear Regression [Anchored, Band, Signals] indicator is a comprehensive statistical analysis tool that plots dynamic regression channels and deviation bands to help traders visualize price distribution and momentum quality. It offers a flexible framework for identifying support and resistance levels through least-squares calculations, supporting both rolling windows and anchored timeframes.

Usage

This tool is used to identify mathematical price extremes and momentum shifts. By analyzing where price sits relative to the regression mean, users can identify potential mean-reversion zones or trend breakouts.

Key Usage Examples:

  • Mean Reversion: When price stretches to the outer deviation bands, it indicates a statistical extreme. Traders often look for price to return to the central orange regression line.
  • Breakout Identification: A price break outside the primary deviation boundaries, especially when accompanied by a high slope angle (Theta), signals a significant momentum shift.
  • Market Filtering: Use the Pearson’s R (correlation) value to avoid choppy markets. A high R-value suggests a strong linear trend, while a low value indicates a sideways or non-linear market.
  • Historical Auditing: Enable "Band (Historical Plots)" to see the non-repainting historical state of the bands, allowing for an honest backtest of how price interacted with the levels in real-time.

Details

The indicator utilizes the least-squares method to determine the line of best fit for price data over a specified lookback. Unlike standard regression channels that only show the current state (and thus "repaint" their historical lines), this script includes a historical plotting feature that locks in the values at each bar.

It calculates several advanced metrics:

  • Pearson’s R: Measures the strength of the linear relationship between time and price.
  • Theta (θ): Represents the slope of the channel in degrees.
  • Dynamic Deviations: Calculates standard deviation and historical absolute highest/lowest limits relative to the mean.

Settings

Main Inputs

  • Period: The lookback length for the calculation.
  • Length Unit: Choose between "Bar" (fixed rolling window) or specific Time Frames (anchored window that resets daily, weekly, etc.).
  • Source: The price data point used for calculation (default is Close).
  • Scale: Choose between Linear or Logarithmic to match your chart's scale settings.

Levels & Display

  • Regression Line: Toggles the central mean line.
  • Upper/Lower/Custom: Standard deviation band toggles and multiplier settings.
  • Highest/Lowest: Toggles bands based on the historical maximum/minimum price deviations.
  • Band (Historical Plots): Enables non-repainting historical visualization of the channel levels.
  • Labels: Toggles for Pearson’s R, Theta angle, and Daily Percentage change metrics.

Signals

  • Channel Strategy: Select from five different logic modes including Break-Out and Mean Reversion strategies.
  • Filters: Thresholds for Theta angle and Pearson's R to gate entry signals based on trend strength and slope.

FAQ

How do I interpret the Theta (θ) angle? The Theta angle represents the slope of the trend. A positive angle indicates an uptrend, while a negative angle indicates a downtrend. Using the Theta filter helps ensure you only take signals when the trend has a minimum required steepness.

What is the benefit of the "Highest & Lowest" bands? While standard deviation bands are based on volatility, the Highest and Lowest bands track the actual historical maximum excursions of price from the regression line within the lookback period, providing "hard" mathematical boundaries.

How can I access the Linear Regression [Anchored, Band, Signals] 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.