# The Linear Regression Channel In this Indicator Spotlight, we’re looking at the Regression Channel. It is a commonly used technical indicator to determine trend direction and buy / sell zones. To learn more about the Linear Regression Channel and the Regression Channel calculation, check out this video, or continue reading below:

## Linear Regression Channel Calculation:

The Regression Channel indicator consists of three parts: The Linear Regression Channel mid-, upper- and lower lines. The Linear Regression Channel midline is calculated using the least squares method. It represents the best fit, minimizing the sum of squared distances from the data in lookback period. The linear regression analysis is used for two purposes:

• To check the stochastic dependence of two variables (i.e. trading prices and time)
• To forecast future price development

The upper and lower lines run parallel to the mid-line and are determined by a standard deviation calculation. When prices deviate above or below the mid-line, traders may expect prices to revert back towards the Linear Regression Channel mid line.

## Linear Regression Channel Setups:

During uptrends, when prices dip below the Linear Regression Line, it can be considered a buying opportunity. For example, you may consider bullish reversal setups that occur towards the lower channel line. A possible exit scenario materialize when prices approach the upper area of the channel.

In an downtrend you’ll look for short setups around the upper levels of the channel – and buy to cover at the lower end. For example, you may consider bearish reversal setups that occur towards the upper channel line and exit when prices approach the lower area of the channel.

## Regression Channel Repainting vs. Regression Bands

The indicator calculates the regression line for a window of N bars. When the current bar closes, it recalculates and the channel lines adjust accordingly (repainting behavior). The position of the lines should therefore not be misinterpreted. Price action may retroactively appear to bounce off Regression Channel support resistance lines that at the time of the calculation were placed differently. Specifically, that means that the Regression Channel lines cannot easily be used in combination with other indicators or strategies.

In the below example, we see a bearish reversal pattern that appear to meet resistance at the upper Regression Channel line. However, by observing the regression bands, we see that at the time of calculation, the channel was indicating an uptrend.

Specifically, the regression bands represent the end points of the regression channel at the time of calculation (current price N bars ago). These values (middle, upper, lower) are not retroactively modified and can be used for trading strategies.

## Standard Linear Regression Channel Limitations:

The default NinjaTrader Linear Regression Channel indicator comes with the following limitations:

• The default indicator calculates from the last bar loaded by OnBarUpdate(). When the chart scrolled back horizontally, the regression channel remains in its future position, until it drops out of the chart.
• The default indicator does not allow for calculating the linear regression channel a few bars ago and then project the channel lines forward until the current bar.

## Library Linear Regression Channel Improvements:

The LizardIndicators Linear Regression Channel version addresses the issues as follows:

• The regression channel is calculated from the last bar shown on the chart and will adapt its position accordingly when you scroll back the chart horizontally.
• You may enter an offset and calculate the regression channel a few bars ago. The regression channel will then be extended until the last bar shown on the chart.
• Regression bands that trace the regression channel at the time of calculation (current price N bars ago). These values (middle, upper, lower) can be used for automated trading strategies.

## Linear Regression Channel Dataseries:

In addition, this indicator comes with the following dataseries:

• Intercept
• Slope
• StdDeviation
• NormalizedSlope
• NormalizedChannelWidth
• RegressionTrend

The Intercept, Slope and Standard Deviation are needed to draw the Regression Channel. In particular, the SlopeSeries and StdDeviationSeries are relevant for trading strategies.

SlopeSeries: indicates the current slope of the regression line (rise over run) and measuring the trend strength.

StdDeviationSeries: indicates the current residual standard deviation, which is a measure of the quality of the trend (width of the channel)

NormalizedSlope: The slope does not provide meaningful values ​​unless it is related to volatility. For example, on a daily chart the slope can frequently be 100 times the size of that in minute chart. Therefore, our Regression Channel indicator also comes with a normalized slope, determining comparable values ​​for the trend strength across all chart types and time frames. That in turn can be applied as filter for trading systems, i.e. only take positions if the trend is recognizable but not too advanced.

RegressionTrend: Finally, there is the DataSeries Regression Trend. This contains either the value + 1 (positive channel slope) or -1 (negative channel slope).

## The Daily Regression Channel

A Daily Regression Channel indicator is also available from the library. Unlike the standard Regression Channel which is based on data from a fixed lookback period, the Regression Channel Daily is anchored at the start of the session. In other words it is a session indicator with similar properties to the Current Day VWAP.  The calculation is based on the bars in the defined session (ETH, RTH or custom), continuously increasing until the end of the session. Therefore, the daily channel stabilizes towards the end of the session.