Trend & directionLeast Squares Moving Average · LSMA
The endpoint of a rolling linear regression line — a moving average that leans into the trend to cut lag.
Works best in trending marketsEngine-computed on a fixed sample series
What it is
The Least Squares Moving Average, or LSMA, is a moving average that reduces lag by fitting a straight line to recent prices and plotting where that line ends, rather than simply averaging the prices. It goes by several names, including the linear regression curve and the endpoint moving average, all describing the same idea. A simple moving average treats every past price with equal weight and always trails behind, but the LSMA accounts for the slope of recent data, so when price is trending it projects the regression line forward to its current endpoint and hugs price far more tightly. For a beginner, imagine drawing the best-fit straight line through the last several weeks of price and marking today's point on that line; the LSMA connects those points into a low-lag trend curve. The result is a moving average that leans into the trend and reacts a few bars sooner than a conventional one.
How it is calculated
For each bar the LSMA performs a linear regression over the last N prices, using the method of least squares, which finds the straight line that minimizes the total squared vertical distance between the line and the actual prices. That regression produces a slope and an intercept describing the best-fit trend of the window. Instead of plotting the whole line, the LSMA plots only its value at the most recent bar, the endpoint of the fitted line, which is the regression's best estimate of where price should be right now given the recent trend. Because this endpoint incorporates the slope, it sits ahead of where a simple average of the same prices would sit whenever price is trending. As each new bar arrives, the regression is recomputed over the shifted window and the new endpoint is plotted, tracing out the LSMA curve.
Reading it, step by step
Read the LSMA as a responsive trend line: when it is rising and sits below price, the trend is up and healthy, and when it is falling and sits above price, the trend is down. Its slope is the trend direction, and because the LSMA lags less than an SMA, a change in that slope arrives earlier as an advance warning of a turn. Crossovers of price through the LSMA, or of a fast LSMA through a slow one, occur several bars before the equivalent SMA crossovers, giving earlier entries and exits. The tight way the LSMA tracks price also makes it a useful dynamic support and resistance line in a trend. Be alert, though, that the same low-lag responsiveness makes the LSMA prone to hooking sharply, so a sudden change in its slope during choppy conditions can be a false alarm rather than a genuine turn.
Best timeframes and settings
A twenty-five period LSMA is a widely used default that balances responsiveness and stability, and it works well on daily swing charts. Because it is simply a regression endpoint, it adapts to any timeframe, and intraday traders use shorter lengths for quicker signals. Shortening the length makes the LSMA track price aggressively and react almost immediately, which is powerful in a clean trend but produces frequent hooks and false turns in noise. Lengthening it smooths the curve and steadies the trend read at the cost of the early-signal advantage that is the whole point of the tool. The core trade-off mirrors every moving average, but the LSMA sits toward the low-lag, higher-overshoot end of the spectrum, so choosing the length is really choosing how much overshoot you can tolerate in exchange for lead time.
When and where to use it
The LSMA is a trend tool and shines in trending markets, where its low lag lets you capture more of each move than a lagging average would. It applies across all liquid asset classes, since linear regression makes no assumption about the instrument. It is most valuable as a drop-in replacement wherever you would use a moving average for trend direction or dynamic support and resistance, gaining a few bars of lead time. In a sideways, choppy market its responsiveness turns against it, producing whippy hooks and false crossovers as the regression endpoint reacts to noise. Use it when you want early trend signals and are trading an instrument capable of sustained directional moves, and be cautious deploying it in a tight range.
Strategies that use it
The simplest strategy substitutes the LSMA for a standard moving average in a trend-following system, taking longs when price closes above a rising LSMA and exiting on a close back below, benefiting from the earlier signals. A dual-LSMA crossover approach runs a fast and a slow LSMA and trades their crosses, which fire ahead of the equivalent SMA crosses. A pullback strategy treats the rising LSMA as dynamic support in an uptrend, buying dips that hold the line with a stop just beneath it and targeting a continuation of the trend. Because the LSMA is a regression endpoint, some traders also watch the slope of the underlying regression as a momentum confirmation, only taking long entries while both price is above the LSMA and the LSMA slope is positive.
Combining it with other indicators
The LSMA pairs well with a momentum oscillator such as the RSI or the MACD, which confirms that a price-versus-LSMA crossover carries force rather than being a noise-driven hook. A trend-strength gauge like the ADX helps distinguish the trending conditions where the LSMA excels from the ranges where it whipsaws. Because the LSMA can overshoot, a volatility band such as Keltner Channels provides context for how stretched price is relative to the trend. It also complements a linear-regression channel naturally, since both derive from the same least-squares fit, letting you use the channel rails for entries around the LSMA centerline. The guiding idea is to confirm the LSMA's early signals with independent momentum or regime information so you are not acting on every hook.
Where it fails
The LSMA's reduced lag is bought with more overshoot, so its greatest weakness is a tendency to hook sharply and issue false turns in choppy conditions, catching traders who trust its every wiggle. A single outlier bar can tilt the regression line and distort the endpoint, producing a jerk that does not reflect the underlying trend. Because it responds so quickly, it whipsaws in ranges where a slower average would have stayed calm. It is also nearly identical to the Time Series Forecast, which projects the regression one step further, so pairing the two adds little genuine diversification and can create false confidence from two views of the same math. The defenses are to use an adequate length for the timeframe, to confirm signals with an independent indicator, and to avoid deploying it in obvious sideways chop.
A worked example
A stock trends upward and you plot a twenty-five period LSMA alongside a twenty-five period simple moving average. Price pulls back from forty to thirty-seven, and the LSMA, being low-lag, flattens and turns down two bars before the SMA does, warning you early that momentum is cooling. When buyers return and price closes back at thirty-eight, the LSMA hooks upward and price crosses above it a full three bars before it crosses the still-lagging SMA. You enter long at thirty-eight, ahead of traders using the SMA, and place a stop at thirty-six-fifty just beneath the rising LSMA, which now acts as dynamic support. Price resumes its climb to forty-four, and you trail your stop along the LSMA, exiting on a decisive close back below the line, having captured extra profit thanks to the earlier signal.