Skip to content

LINEARREG

Summary

Least-squares straight-line fit over the last optInTimePeriod bars, reported as the fitted line value at the window endpoint (b + m*(period-1)).

Inputs

  • inReal — Series to fit

Outputs

  • outReal — Regression line value at the window endpoint

Parameters

  • optInTimePeriod — Number of bars in each regression window

Implementation

TA-Lib Definition: linearreg.c · linearreg.yaml

Native File
C ta_LINEARREG.c
Rust linearreg.rs
Java Core.java

TA-Lib is also available for Python, R and more using a wrapper.

Aliases

Linear Regression, Least Squares, Best Fit Line

See Also

LINEARREG_SLOPE · LINEARREG_ANGLE · LINEARREG_INTERCEPT · TSF