Rolling Window Linear Regression
Rolling Window Linear Regression
Trend identification and automated chart drawing tool.


  • Draws a linear regression channel automatically.
  • Starts from the beginning of a period like the month, week, or day to draw a forecast.
  • Forecast the linear regression using the past data into the next period.
  • Customize the lookback period and timeframe used, or stick to the automated settings.
Demo on TradingView

Use code BLACKFRI for 10% off your purchase!

Free on TradingViewWhat is Whop?Purchase Indicator

Trading Rules

Mean Line

When the mean is orange, this covers the candles that have been sampled and used to calculate the linear regression.

When the mean is red, this signals that the linear regression is not sampling data and creating a forecast.

Mean Reversion Strategy

If you expect price to continue in an established linear regression trend, then buying the lower deviations and selling the higher deviations, expecting price to over time follow the mean of the regression, would be the trading assumptions to apply.

When trading the deviations, buying the lower or selling the upper, then understand the standard target for such trades is the mean of the regression. A more aggressive target would be the 1st deviation. E.g. shorting the upper 2nd or 3rd deviation, and targeting the mean or 1st lower deviation.

Breakout Strategy

If you do not expect the prior trend to continue, then you could anticipate a break of the 3rd deviation of the linear regression. You will need to generate a bias though as to which, the upper or lower, 3rd deviation will be reached.

Indicator Settings