@pond-ts/financial API Reference
    Preparing search index...

    Function timeSeriesForecast

    • 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).

      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.

      • 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 shifttsf(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.

      Type Parameters

      • S extends SeriesSchema
      • const Output extends string = "tsf"

      Parameters

      Returns TimeSeries<
          readonly [S[0], ValueColumnsForSchema<S>, OptionalNumberColumn<Output>],
      >