# 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:

## Linear Regression Channel Calculation:

The Regression Channel indicator consists of three parts: The Linear Regression Channel mid-, upper- and lower lines. One may calculate the Linear Regression Channel midline using “the least squares method”. It represents the best fit, minimizing the sum of squared distances from the data in lookback period. You may then use the linear regression analysis for two purposes:

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

As you may see below, the upper and lower channels lines run parallel to the mid-line, 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, one may consider long setups. 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.

## Repainting Lines 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). You should therefore not misinterpret the position of the lines. 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 you cannot easily use the Regression Channel lines with other indicators or apply them in trading systems.

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). You may therefore use the mid, upper and lower values in trading systems as their position cannot bemisinterpreted.

## Common 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.

## Our 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. It 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). You may apply these values (middle, upper, lower) with automated trading strategies.

## Indicator 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. For example, only enter positions if the trend is recognizable, but not too far 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 Daily version 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. 