Using the Line Regression Intercept as a Slow Trend Filter
Summary
The Line Regression Intercept (LRI) fits an ordinary least-squares line to a rolling window of closing prices, then plots the fitted value at the window’s oldest bar. Because this is not the fitted value at the current bar, the baseline trails price and is intended to change direction less often. The example uses a 14-bar window. A state variable marks closes above the line as bullish and below it as bearish, carrying the prior state when neither comparison applies; candles are recolored to show that state.
The document explains how fixed sums in the regression can be calculated directly, while the price-dependent cross-product is accumulated across the window. It also discusses warm-up handling, price indexing, and plotting the line on the chart alongside overlaid candles. It recommends interpreting color changes as a bias filter for faster entry methods, not as standalone trade signals. The description offers no backtest or performance evidence; the line’s lag, sensitivity to window length, and platform-specific implementation need consideration before use.
Key ideas
- The LRI plots the fitted regression value at the oldest bar of its price window.
- That choice creates a slow baseline that can act as a directional filter.
- A carried state labels closes above the line as bullish and closes below it as bearish.
- The calculation uses closed-form sums for fixed bar offsets and a loop for the price cross-product.
- The author advises treating state changes as bias information rather than standalone trade signals.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.