Time Series Forecast (TA-Lib TSF) — the period-bar least-squares
fit of the column against the bar index, projected one bar past the
window:
${output}[i] = intercept[i] + slope[i] · period
where intercept is the fit at the window's first bar (x = 0), so
x = period − 1 is the current bar (linearRegression's
linregValue) and x = period is the next one. It is a forecast only
in the narrow sense that it extrapolates the fitted line by one step;
nothing here estimates a distribution, and the value is plotted on the
current bar like every other study in the package.
Exact against TA-Lib, mask and values (measured ≤ 2.1e-13 at
period 14, identical warm-up at period − 1).
Also called the "time series moving average"
It is a smoother — an end-point-projected regression line — and vendors
list it in their moving-average menus under that name. It is deliberately
not a member of the K2 MaType engine, and the reason is a
contract the engine has and a regression cannot keep: every type in that
menu is the identity at period 1, and a one-bar window has no slope
(the regression denominator n²(n²−1)/12 is 0 at n = 1). Adding it
would mean a per-type minimum period, which is a change to the engine's
shape rather than one more case — so this ships as a study, and a
caller who wants a regression smooth calls it directly.
Edges
period must be at least 2 (see above), and the study throws
rather than emitting 0/0.
A flat window reads the flat price back, exactly: the slope is
forced to zero, so the projection is the level itself.
Equivariant to scale and shift — tsf(a·y + b) = a·tsf(y) + b,
like any linear filter and like every MaType in the engine.
The strict window (all period cells finite): a leading gap shifts
the start, an interior gap blanks period bars and then recovers. See
linearRegressionValues for why a positional regressor cannot
skip a cell.
A misnamed column reads all-missing rather than throwing.
Time Series Forecast (TA-Lib
TSF) — theperiod-bar least-squares fit of the column against the bar index, projected one bar past the window:where
interceptis the fit at the window's first bar (x = 0), sox = period − 1is the current bar (linearRegression'slinregValue) andx = periodis the next one. It is a forecast only in the narrow sense that it extrapolates the fitted line by one step; nothing here estimates a distribution, and the value is plotted on the current bar like every other study in the package.Exact against TA-Lib, mask and values (measured ≤ 2.1e-13 at
period 14, identical warm-up atperiod − 1).Also called the "time series moving average"
It is a smoother — an end-point-projected regression line — and vendors list it in their moving-average menus under that name. It is deliberately not a member of the K2 MaType engine, and the reason is a contract the engine has and a regression cannot keep: every type in that menu is the identity at
period 1, and a one-bar window has no slope (the regression denominatorn²(n²−1)/12is0atn = 1). Adding it would mean a per-type minimum period, which is a change to the engine's shape rather than one morecase— so this ships as a study, and a caller who wants a regression smooth calls it directly.Edges
periodmust be at least 2 (see above), and the study throws rather than emitting0/0.tsf(a·y + b) = a·tsf(y) + b, like any linear filter and like every MaType in the engine.periodcells finite): a leading gap shifts the start, an interior gap blanksperiodbars and then recovers. See linearRegressionValues for why a positional regressor cannot skip a cell.columnreads all-missing rather than throwing.