Regression Indicators
Linear regression applied to price -- best-fit trend lines, slope, angle, and the Time Series Forecast.
What are Regression Indicators?
Regression indicators fit a straight line through the most recent N closing prices using linear regression -- the same "best fit line" concept from statistics class. Instead of averaging all the prices equally like an SMA, the regression line finds the straight line that comes closest to all the data points at once.
The result is a trend line that tracks the current price direction with less lag than a moving average. The regression line ends at (or near) the current price, while an SMA of the same period sits further behind because it averages all the prices in the window equally.
The Indicators
LINEARREG (Linear Regression Value)
The value of the best-fit line at the current candle. If you drew a straight line through the last N closing prices, LINEARREG tells you where that line ends right now. It appears on the price chart as an overlay, similar to a moving average but more responsive.
Compared to an SMA of the same period, LINEARREG sticks closer to the current price. This means less lag during trends, but it also means LINEARREG can overshoot -- during a sharp reversal, the regression line initially continues in the old direction before curving back.
LINEARREG_SLOPE
The slope of the best-fit line -- how steeply it is angled. A positive slope means the regression line is pointing up (prices have been rising over the window). A negative slope means it is pointing down. The magnitude tells you how steep the trend is: a slope of 0.5 means the best-fit line rises by 0.5 price units per candle.
Slope is useful for measuring trend strength numerically. A slope near zero means the price has been moving sideways over the lookback window, regardless of individual candle movements.
LINEARREG_ANGLE
The slope expressed as an angle in degrees rather than as a rate of change. An angle of 45 degrees means the price is rising by one price unit per candle. An angle of -30 degrees means the regression line is declining at a moderate rate. Zero degrees means perfectly sideways.
Angle conveys the same information as slope in a more intuitive format. Some traders find it easier to think in degrees (45 degrees = strong trend, 10 degrees = gentle drift) than in price-per-candle units.
LINEARREG_INTERCEPT
Where the best-fit line would cross the y-axis if extended backward. This is the starting point of the regression line at the beginning of the lookback window. Most traders do not use the intercept directly -- it is a mathematical byproduct of the regression calculation. LINEARREG (the value at the current candle) and SLOPE are more practical.
TSF (Time Series Forecast)
The regression line projected one candle forward. While LINEARREG gives you where the best-fit line ends at the current candle, TSF extends it one step ahead -- where the line would be on the next candle if the trend continued at the same rate.
TSF is the most practically useful regression indicator for chart overlays. It acts like a leading moving average -- it stays closer to the current price than LINEARREG and reacts even faster to trend changes. Some traders use TSF crossovers with price (price crossing above/below TSF) as trend signals.
Reference Table
| Indicator | Output | Display | Parameters |
|---|---|---|---|
| LINEARREG | Regression endpoint (price) | On price chart | period (14) |
| LINEARREG_SLOPE | Slope (price/candle) | Separate panel | period (14) |
| LINEARREG_ANGLE | Angle (degrees) | Separate panel | period (14) |
| LINEARREG_INTERCEPT | Y-intercept (price) | Separate panel | period (14) |
| TSF | One-step forecast (price) | On price chart | period (14) |
How the Period Affects Behavior
All five indicators share a single period parameter that controls the lookback window.
Short period (e.g., 5-10): the regression line fits only the most recent candles, making it very responsive. It tracks price closely but can whipsaw on noisy data because a few candles heavily influence the fit.
Long period (e.g., 20-50): the regression line fits a larger window, producing a smoother trend estimate. It is less sensitive to individual candles but slower to react when the trend genuinely changes.
Common Mistakes
Treating TSF as a price prediction
TSF projects the regression line one candle ahead, but this is not a forecast of where the price will actually go. It is a mathematical extrapolation that assumes the current trend continues unchanged. The price can (and will) deviate from the TSF value. TSF is better thought of as a leading trend indicator than a crystal ball.
Ignoring overshoot at reversals
Because the regression line fits a straight line through the window, it initially continues in the old direction when the price reverses. If the price has been rising for 10 candles and then drops sharply, the regression line will still point up until enough of the window contains the new downward data. This overshoot can generate false signals at turning points.
Where to Go Next
Moving Averages -- the more widely used approach to smoothing price data, with less overshoot but more lag.
Trend Indicators -- ADX, MACD, and other tools for measuring trend direction and strength.
Cycle Indicators -- Hilbert Transform indicators that separate cyclic and trending components of price.