All indicators

Linear Regression ++

Apr 17, 2020

Static chart image
Support and ResistanceSignalsChannels

The Linear Regression ++ indicator provides a feature-rich implementation of linear regression channels designed to identify trend direction, potential breakouts, and overextended market conditions.

Usage

The Usage section focuses on identifying trend shifts and exhaustion points using the regression channel. Traders can utilize the upper and lower bands as dynamic support and resistance levels to spot potential reversals or breakout opportunities.

  • Reversals: When price action crosses the lower regression band, it may indicate an oversold condition suitable for "Buy" signals. Conversely, crossing the upper band suggests an overbought state for "Sell" signals.
  • Trend Confirmation: The color-coded centerline indicates the immediate trend direction. A change in color (e.g., green to red) signifies a shift in the regression slope.
  • Multi-Timeframe Analysis: Users can source the regression calculation from a higher timeframe to align local price action with broader market trends.
  • Filtering: The smoothing setting allows users to filter out market noise, creating a more stable regression line that reacts less to volatile price spikes.

It is important to note that like Bollinger Bands, price can "ride" the bands during strong trends. This tool is intended to be used in conjunction with other technical analysis methods rather than as a standalone signal generator.

Details

The script calculates a linear regression line based on a specified lookback period and standard deviation. It determines the line of best fit for the price data, minimizing the distance between the data points and the line.

A unique aspect of this implementation is the inclusion of a smoothing mechanism via a Simple Moving Average (SMA) applied to the security request. This allows the regression calculation to be derived from a filtered data stream. The script also features a "Displacement" mode, which, when enabled, allows the historical projections of the regression channels to remain on the chart rather than updating only at the most recent bar.

Settings

Algorithm Config

  • Resolution: Sets the timeframe for the regression calculation (MTF support).
  • Source: The price data point used for calculations (e.g., Close, HL2).
  • Length: The lookback period used to calculate the linear regression and deviation.
  • Deviation: The multiplier for the standard deviation bands.
  • Offset: Shifts the regression calculation by a specified number of bars.
  • Smoothing: Applies a moving average to the input data to filter noise.

Display Config

  • S&R Size: Adjusts the thickness of the channel lines.
  • Hide Old Signals: When enabled, removes historical Buy/Sell labels to declutter the chart.
  • Up/Down Colors: Customizes the color scheme for bullish and bearish trends.
  • Show Displacement: Toggles whether to keep historical channel lines on the chart.
  • End Of Calculating: Sets a specific timestamp to stop calculating the regression lines.

FAQ

How do I interpret the Buy and Sell labels? Buy labels appear when the price crosses under the lower deviation band, while Sell labels appear when the price crosses over the upper deviation band, indicating potential exhaustion.

What does the smoothing setting do? The smoothing setting applies an SMA to the source data. A value of 1 uses the raw price, while higher values result in a smoother, slower-reacting regression channel.

How can I access this script? 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.