talib.linreg
Fits a linear regression to source across length bars and returns a value from that fit.
The offset argument shifts which point of the fit you get back.
talib.linreg(series float source, series int length, series int offset) → series float| Parameter | Type | Required | Description |
|---|---|---|---|
source | series float | yes | The series the line is fitted to. |
length | series int | yes | How many bars the fit covers. |
offset | series int | yes | Shifts the point on the fit that is returned. An int. |
Returns series float — A series float taken from the fitted line.
indicator("Linear regression")
plot(talib.linreg(close, 20, 0))See also talib.alma · talib.atr · talib.barssince
Part of the function index.
Ready to put this into practice?
Try GoCharting Premium
Unlock advanced orderflow, market profile, options desk, and real-time data — everything you just read about, live in your charts.