Linear Regression Forecast

Linear Regression Forecast
Indicator

TrendOn the price chartFree on ChartLabs

Linear Regression Forecast fits a straight line to the 14 closes before the current bar and extends it toward that bar: where the recent trend pointed.

Built on the moving regression in The New Technical Trader by Tushar Chande and Stanley Kroll, 1994. Reviewed by the ChartLabs team, updated Nov 2026.

Example market1hIndicatorsAtlas AILinear Regression Forecastchartlabs.co/charts
Atlas reads it

Price is under a falling Forecast 14. The 14-bar fit points down.

Forecast 14 69,910.2 · Close 69,570.0

Atlas reads it

Price is under a falling Forecast 14. The 14-bar fit points down.

Forecast 14 69,910.2 · Close 69,570.0

Illustration on simulated data.

Linear Regression ForecastWhat is the Linear Regression Forecast indicator?

The forecast draws one grey line on the price chart. Each bar it fits a least-squares line through the 14 closes before that bar and reads the line half a bar past the newest of them, just before the current bar.

The current close is not in the fit. So the line shows where the recent trend pointed, and the close shows where price actually went. Closes above a rising forecast mean price is at least keeping pace with its trend.

It stays close to price, much like a Least Squares Moving Average built one bar earlier. In a steady trend it rides with the closes; after a sharp turn it keeps the old slope for a bar or two.

Half a bar back

ChartLabs reads the fitted line half a bar before the current bar: the mean of the 14 closes plus 7 times the slope. The live bar's value is set when the bar opens.

Warm-up

The first value is on the 16th bar. Earlier bars are left empty.

Linear Regression Forecast signalsFive patterns to know.

1Bullish

Price above a rising forecast

Closes keep beating the line the earlier bars projected.

2Bearish

Price under a falling forecast

Closes keep falling short of a line that points down.

3Bullish lean

Close back above

After a run under the line, a close lands above it and the next closes hold.

4Bearish lean

Close back under

After a long run above, price closes under the line and stays there.

Many crosses, no trend
5Inconclusive

Crossed both ways

Price crosses the line in both directions and the line goes nowhere.

Linear Regression Forecast formulaHow it is calculated.

y¯=mean of the 14 closes before the barb=their least-squares slopeForecast=y¯+b×142
STEP 1

Take the earlier closes

Use the 14 closes before the current bar.

STEP 2

Fit a line

Find the least-squares line through them: its mean and its slope per bar.

STEP 3

Extend it

Read the line half a bar after the newest of those closes: the mean plus 7 times the slope. That value is plotted on the current bar.

Linear Regression Forecast settingsEvery setting, explained.

SettingDefaultRangeWhat it changes
Length142 to 5,000Closes in the fit. Longer gives a steadier, slower line.
SourceCloseAny priceWhich values feed the fit.
LineGrey #999999, 1 pxAny colour and widthColour and width of the line.
Setting
Length
Default
14
Range
2 to 5,000
What it changes
Closes in the fit. Longer gives a steadier, slower line.
Setting
Source
Default
Close
Range
Any price
What it changes
Which values feed the fit.
Setting
Line
Default
Grey #999999, 1 px
Range
Any colour and width
What it changes
Colour and width of the line.
1438 price crosses in view
70,28566,88163,47860,07564,803.7

Drag to see how the setting changes the lines and how many signals you get. Illustration on simulated data.

Linear Regression Forecast strategiesUse it in 3 setups.

Close beats the forecast

Ifprice closes aboveForecastafter5closes under it

A close above the line the earlier bars projected suggests the decline has stopped carrying on. Traders often wait for a second close.

Trend filter

Only long whileprice is aboveForecastandForecastrises

Closes above a rising projection mean the trend is holding its pace.

Exit when price falls short

Ifprice closes underForecastaftera long run abovethenclose the long

The close came in below where the recent trend pointed, a common reason to step aside.

Test a rule in the Strategy TesterFree with 1 year of history. Past results do not guarantee future results.

Linear Regression Forecast mistakesCommon mistakes.

Through the line and straight back

Acting on every close through it

The line sits close to price, so closes cross it often. Here a cross was undone within two bars.

Many crosses, no trend

Trading crosses in a range

With no trend to extend, the forecast wanders and crosses in both directions mean little.

The lowThe cross comes later

Expecting it to call the low

The line extends past closes, so it turns after price does. Here the close above it came a few bars after the low.

Linear Regression Forecast combinationsPair it with these.

Linear Regression Forecast FAQQuestions traders ask.

What are the default Linear Regression Forecast settings?

Length 14 on the close.

How is the forecast calculated?

It fits a least-squares line to the 14 closes before the current bar and reads it half a bar before that bar: the mean plus 7 times the slope.

Is it a price prediction?

No. It extends a straight line through recent closes. Prices rarely follow it for long.

Why is the current close not in the fit?

So the line shows where the trend pointed before the bar, and the close can be compared with it. It also means the live bar's value does not move.

Linear Regression Forecast or TSF?

TSF fits the 14 closes up to the current bar and reads 3 bars ahead, so it leads price. This forecast fits the closes before the bar and reads just before it, so it sits close to price.

Forecast or LSMA?

Both read the end of a fitted line. LSMA includes the current close; the forecast uses the closes before it.

Why does my value differ from another platform?

Some platforms include the current close or read the line a full bar ahead. ChartLabs fits the 14 closes before the bar and reads half a bar before it.

Does the forecast work on crypto?

Yes. It works on any market with closes.

Does it repaint?

No. Closed bars never change, and the live bar's value is set when the bar opens.

Is it leading or lagging?

Lagging. It extends a line through past closes.

Related indicatorsMore trend tools.

All trend indicators

Try Linear Regression Forecast on a live chart.
Free. No download.

Works in your browser and on iPhone too.

Example market1h
LR Forecast (14, close)