LinRegSlope
forge.taclassSince Forge API 1
Signaturepython
forge.ta.LinRegSlope(**inputs: Any) -> NoneHow much the fitted line rises or falls per bar.
Inputs
| Name | Type | Default | Range |
|---|---|---|---|
| source | source | close | |
| period | int | 14 | 2 to 5000 |
Indicator: Linear regression slope
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
Slope = b