The number line to fit the regression through — usually a price series, but any buffer works (an oscillator, a moving average, a spread).
Outputs
Bundle (untagged)
A bundle carrying the fitted line: its current value, its slope (sign and steepness of the trend), and its intercept.
Rolling Linear Regression fits a straight ‘best-fit’ line through the last `period` bars of a series and reports where that line sits, how steep it is, and where it crosses. It’s a smooth, lag-light read on the local trend and its direction.
How it works
On every bar the tool takes the most recent `period` values of the input and runs an ordinary least-squares fit — the line that minimises the squared distance to those points. From that fit it exposes the line’s current value (its right-hand endpoint), its slope (positive = rising trend, negative = falling), and its intercept. A larger `period` gives a smoother, slower line; a smaller one hugs price more tightly.
Configuration
periodscalar
How many recent bars the line is fitted over. Larger = a smoother, slower line that ignores short wiggles; smaller = a line that tracks recent swings more closely but is noisier. A typical choice is 14–50 bars.
Connects to
Reads from
Feeds into
Examples
Trend filter: read the slope and only allow long entries when the regression line over the last 50 bars is rising.
Mean-reversion baseline: treat the regression value as a dynamic centerline and fade price when it stretches far from it.
Common mistakes
Using too short a period, which makes the slope flip sign on every small wiggle and turns the trend read into noise.
Reading the line as a forecast — it describes the fit over past bars, it does not project where price will go next.