# forge.ta.linreg

```python
forge.ta.linreg(source: ArrayLike, period: int = 14) -> np.ndarray
```

The regression line at the newest bar of the window: ``a + b * (period - 1)``.

Since Forge API 1.

## Class forge.ta.LinReg

```python
forge.ta.LinReg(**inputs: Any) -> None
```

Least squares line fitted to the last N values, read at the newest bar.

Fit a straight line by least squares to the last period values, with t = 0 at the oldest.

b = (period * sum(t*y) - sum(t) * sum(y)) / (period * sum(t^2) - sum(t)^2)

a = (sum(y) - b * sum(t)) / period

LinReg = a + b * (period - 1)

Since Forge API 1.
