Indicators · Statistics
Time Series Forecast (TSF): linear regression projected one bar
How the Time Series Forecast fits a least-squares line to recent closes and extends it one bar, a worked Adobe example, how well its forecasts did, and Finabase’s TSF.
On this page
The Time Series Forecast (TSF) fits a straight line through the last n closing prices by least squares and then extends that line one bar into the future. The value plotted today is where the recent trend line says the next bar should be. Charting software sometimes calls the same idea a moving linear regression or a linear regression forecast.
The name promises a forecast, and the arithmetic delivers one, in the narrow sense of "what the straight-line trend implies." Whether that is a useful prediction is an empirical question, and on real data the answer is humbling. This guide calculates TSF by hand on Adobe's chart, tests how accurate its one-day forecasts were over six months, and explains when the indicator is still useful.
How TSF works
Number the last n bars 0, 1, … n − 1, oldest to newest. Least-squares regression finds the straight line through those points that minimizes the sum of squared vertical distances to the closes. The line has an intercept (its value at bar 0) and a slope (how much it rises or falls per bar).
TA-Lib, and therefore Finabase, offers two related values:
- Linear regression value (
LINEARREG): the fitted line at the newest bar, x = n − 1. - Time Series Forecast (
TSF): the fitted line one step further, x = n.
The difference between them is exactly one slope. Finabase charts TSF.
The formula
A worked example on Adobe
Here are Adobe's (ADBE) five closes ending October 29, 2026, from Finabase's chart.
| x | Date | Close (y) | x × y |
|---|---|---|---|
| 0 | Oct 23, 2026 | $263.82 | 0 |
| 1 | Oct 26, 2026 | $258.62 | 258.62 |
| 2 | Oct 27, 2026 | $248.36 | 496.72 |
| 3 | Oct 28, 2026 | $249.76 | 749.28 |
| 4 | Oct 29, 2026 | $248.12 | 992.48 |
| Totals | 1,268.68 | 2,497.10 |
With Σx = 10 and Σx² = 30:
| Step | Calculation | Result |
|---|---|---|
| Slope b | (5 × 2,497.10 − 10 × 1,268.68) ÷ (5 × 30 − 100) | −4.026 per day |
| Intercept a | (1,268.68 − (−4.026) × 10) ÷ 5 | $261.79 |
| LINEARREG | 261.79 + (−4.026) × 4 | $245.68 |
| TSF (5) | 261.79 + (−4.026) × 5 | $241.66 |
Finabase's TSF (5) for October 29 is 241.66. The regression line through the week sloped down about $4 a day, so it projected the next close $6.46 below the last one. Note that the fitted line also sits below the actual last close ($245.68 versus $248.12): the last two closes had leveled off, and the straight line ignores that.
TSF on a real chart: Adobe, April to October 2026
Adobe went nowhere over the six months, $246.10 to $248.12, but traveled a long way in between: down to $190.12 on June 18, up to $294.53 on September 1, and back.
Overshooting at the turns. Because TSF extends the recent slope, it overshoots whenever a trend ends. On August 31, after a strong run, TSF (5) reached $300.91, above the actual high that Adobe would make the next day. In late June, TSF (20) bottomed at $177.28, well below the actual low of $190.12, a few days after price had already turned up.
How good were the forecasts? Comparing each day's TSF with the next day's actual close, over 101 sessions:
| One-day forecast of the next close | Average miss |
|---|---|
| "No change" (today's close) | $5.69 |
| TSF (5) | $7.00 |
| TSF (20) | $11.55 |
The naive guess, that tomorrow's close equals today's, was more accurate than either TSF. That is typical: daily price changes are close to unpredictable, and extrapolating a recent trend adds error when trends reverse. TSF (5) did point in the right direction slightly more often than not (59 of 101 days), but its misses at turning points were large.
How traders use TSF
As a low-lag trend line. On a steady trend a TSF sits close to price, unlike a moving average that trails by half its window. Some traders use it in place of a moving average for that reason, accepting the overshoot.
Slope as trend strength. The regression slope, in dollars per bar, is a clean measure of the trend's direction and speed. A TSF line that flattens says the fitted slope is approaching zero.
Comparing TSF with price. A close well above the TSF (5) means the latest bar outran the recent trend line; well below, that it fell short. Some systems treat a cross of price and TSF like a moving-average cross.
Regression channels. Adding bands of a few standard errors around the regression line creates a channel; Finabase charts the TSF line itself.
Pitfalls and limitations
It is not a prediction engine. As the Adobe test shows, a one-step extrapolation of a straight line is not a reliable forecast of the next close.
Overshoot. At every turn, TSF keeps projecting the old trend for a few bars.
Window sensitivity. A 5-bar TSF reacts to almost every swing; a 20-bar TSF is smoother but overshoots more, because its slope reflects a longer trend that may have ended.
Comparison table
| Line | Built from | Lag on a steady trend | At a turn |
|---|---|---|---|
| SMA (n) | Average of the last n closes | (n − 1) ÷ 2 bars | Turns late |
| LINEARREG (n) | Regression line at the latest bar | None | Overshoots a little |
| TSF (n) | Regression line one bar ahead | Leads by one bar | Overshoots more |
| TEMA / DEMA | Combinations of EMAs | About none | Overshoots |
See Simple moving average (SMA): formula, crossovers and limits for the lagging alternative and Correlation coefficient (CORREL): how two series move together for another regression-family statistic.
How Finabase calculates and scores TSF
Finabase computes TSF with TA-Lib's TSF function on closing prices. A new TSF study ("Time Series Forecast") defaults to 5 periods and is
drawn in its own panel, on the same price scale as the stock. You can add several TSF studies with different periods, as in the figure.
TSF (5) appears in the technical gauge on the symbol page with its latest value and carries no Buy or Sell rule, so it always counts as neutral. Read it as the current trend line's next-bar value, not as a price target.
Frequently asked questions
Does the Time Series Forecast predict prices?
It extrapolates the recent straight-line trend one bar ahead. On Adobe's 2026 data its one-day forecasts were less accurate than assuming no change, which is typical for short-term price prediction.
What is the difference between TSF and linear regression?
They come from the same fitted line. The linear regression value is the line at the latest bar; TSF is the line one bar later. They differ by one slope.
What period should I use?
Finabase's default is 5, which reacts quickly. Periods of 14 to 20 give smoother lines that describe longer trends, and overshoot more at turns.
Summary
The Time Series Forecast fits a least-squares line to the last n closes and extends it one bar. It tracks steady trends without lag and overshoots when they end, as Adobe's projection of $300.91 at its September top showed. As a forecast it disappoints: over six months, assuming no change beat both TSF (5) and TSF (20). Use TSF as a low-lag trend line and slope gauge, not as a prediction.
Sources and further reading
- Tushar S. Chande and Stanley Kroll, The New Technical Trader (Wiley, 1994) — linear regression indicators
- TA-Lib — TSF and LINEARREG function reference
- Finabase chart data — ADBE daily bars, 2026-04-30 to 2026-10-29, TSF computed by Finabase