# Rolling Trendline

A self-maintaining trendline that projects its regression slope forward bar by bar and re-anchors only when price breaks statistically from the path. ATR zones wrap the line into dynamic support and resistance, and reset markers expose regime shifts: automated structure for trend, pullback, and breakout traders.

- Indicator in the LuxAlgo Library, by LuxAlgo, published Feb 17, 2026.
- Access: free.
- Concepts: [Trendline](https://www.luxalgo.com/library/concept/trendline/) (primary), [Linear Regression](https://www.luxalgo.com/library/concept/linear-regression/)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=cmpwn5fs9007ovhsgms3tuovo
- Page: https://www.luxalgo.com/library/indicator/rolling-trendline/

**Rolling Trendline** maintains the [trendline](https://www.luxalgo.com/library/concept/trendline/) you would otherwise keep redrawing: it projects a slope forward on every bar and re-anchors only when price deviates beyond a standard-deviation threshold. ATR-based zones wrap the projection, turning one line into volatility-aware support and resistance that never needs manual updates.

The slope is a [linear regression slope](https://www.luxalgo.com/library/concept/linear-regression/) measured across a configurable lookback; each new bar extends the line by it, so the bias persists instead of reshaping bar by bar. When price proves the path wrong, a small circle and a break mark the reset, and the line re-anchors at current price with fresh slope and zone width.

## How to Trade the Rolling Trendline?

- **Green projection**: upward slope, long bias. Pullbacks into the line or the lower ATR zone are the classic continuation entries, with stops beyond the outer band.
- **Red projection**: downward slope. Rallies into the line or upper zone frame short setups the same way.
- **Reset circle**: a re-anchor flags a possible regime shift; when the new slope agrees with a structural breakout, treat it as confirmation rather than noise.
- **Zone width**: expanding bands mean rising volatility, tightening bands mean compression, and compression often precedes the next reset.

## Rolling Trendline Settings

- **Slope Lookback**: history feeding the regression; higher is smoother, lower is more reactive.
- **Deviation Multiplier**: reset sensitivity. Higher values tolerate wider swings before recalibrating.
- **Slope Divisor**: flattens the projected slope, useful on violently volatile assets.
- **Source** (default Close): price input for the calculation.
- **ATR Length / ATR Multiplier**: how volatility is measured and how wide the zones draw.
- **Colors and line width**: visual styling for phases, zones, and the line.

## Frequently Asked Questions

### Why doesn't the line reshape like a normal regression fit?

Because the slope is projected forward and only re-solved at resets, the line keeps its direction between recalibrations. You get a persistent bias instead of a fit that quietly redraws its own past on every bar.

### How is this different from swing-drawn trendlines?

Tools like [Trendlines with Breaks](https://www.luxalgo.com/library/indicator/trendlines-with-breaks/) construct lines from swing pivots and flag breakouts, while Rolling Trendline is statistical: slope from regression, invalidation from deviation. Pivot lines honor visible structure; this one honors the trend's measured rate.

### How do I start using the Rolling Trendline?

Add it free from the LuxAlgo Library, and send it over to Quant, our coding agent, right from this page to see how its resets behave on your market. You can also copy the source code from this page and run it anywhere Pine Script® runs.

## Related indicators

- [Trendlines Oscillator](https://www.luxalgo.com/library/indicator/trendlines-oscillator/) (Trendline): markdown at https://www.luxalgo.com/library/indicator/trendlines-oscillator.md
- [Trendlines with Breaks](https://www.luxalgo.com/library/indicator/trendlines-with-breaks/) (Trendline): markdown at https://www.luxalgo.com/library/indicator/trendlines-with-breaks.md
- [Trendline Breakout Navigator](https://www.luxalgo.com/library/indicator/trendline-breakout-navigator/) (Trendline): markdown at https://www.luxalgo.com/library/indicator/trendline-breakout-navigator.md
- [Trendlines with Breaks Oscillator](https://www.luxalgo.com/library/indicator/trendlines-with-breaks-oscillator/) (Trendline): markdown at https://www.luxalgo.com/library/indicator/trendlines-with-breaks-oscillator.md
- [Power Hour Trendlines](https://www.luxalgo.com/library/indicator/power-hour-trendlines/) (Trendline): markdown at https://www.luxalgo.com/library/indicator/power-hour-trendlines.md
- [Machine Learning Trendlines Cluster](https://www.luxalgo.com/library/indicator/machine-learning-trendlines-cluster/) (Trendline): markdown at https://www.luxalgo.com/library/indicator/machine-learning-trendlines-cluster.md
- [Linear Regression Histogram](https://www.luxalgo.com/library/indicator/linear-regression-histogram/) (Linear Regression): markdown at https://www.luxalgo.com/library/indicator/linear-regression-histogram.md
- [Linear Regression Fan](https://www.luxalgo.com/library/indicator/linear-regression-fan/) (Linear Regression): markdown at https://www.luxalgo.com/library/indicator/linear-regression-fan.md

---

Source: https://www.luxalgo.com/library/indicator/rolling-trendline/ (LuxAlgo Library). Free to use with attribution: https://www.luxalgo.com/library/license/
