Direct Answer
The endpoint of a least-squares regression line fitted to the last n prices, also known as the linear regression value. It tracks price more closely than a simple moving average of the same length because it accounts for slope. Price above a rising LSMA is read as an uptrend and price below a falling LSMA as a downtrend.
Least Squares Moving Average: Formula, Meaning, Signals, Examples and How to Use It
How Is Least Squares Moving Average Calculated?
The endpoint of a least-squares regression line fitted to the last n prices, also known as the linear regression value. It tracks price more closely than a simple moving average of the same length because it accounts for slope.
Formula: LSMA = intercept + slope * (n - 1), from a least-squares line fitted to the last n closes with x = 0 to n - 1
Inputs:
- Closing prices
- Window length n (such as 25)
- Regression slope and intercept for the window
Worked example. A fitted line with intercept 98.0 and slope 0.5 over 20 bars ends at 107.5. The inputs are illustrative numbers, not market data.
Reading it. Price above a rising LSMA is read as an uptrend and price below a falling LSMA as a downtrend. The endpoint extrapolates the fitted line, so it leads a simple average in steady trends.
Limits. The endpoint is the most extreme part of the fit, so it is sensitive to the latest few prices and can overshoot at turns. It assumes a straight-line trend within the window.
What is Least Squares Moving Average?
The endpoint of a least-squares regression line fitted to the last n prices, also known as the linear regression value. It tracks price more closely than a simple moving average of the same length because it accounts for slope.
How to use Least Squares Moving Average
Price above a rising LSMA is read as an uptrend and price below a falling LSMA as a downtrend. The endpoint extrapolates the fitted line, so it leads a simple average in steady trends. A reading alone is never a buy or sell signal; it needs context from price structure, volume, volatility and the broader market regime.
Strengths
- Fitting a line before taking its end value builds the window's slope into the output, so the average adjusts for ongoing drift.
- Its gap from a simple average of the same length equals a slope term, so it is easy to see how much of the value comes from the trend.
- Reproducible when the formula and data convention are fixed.
Weaknesses and limitations
- Noise in the last few bars changes the fitted slope for the whole window, so an outlier near the end shifts the output more than one at the start.
- Very short periods make the endpoint track price almost exactly, which removes most of the smoothing.
- Correlated indicators can create false confidence by repeating the same underlying information.
Editorial and risk note
This page is educational content, not individualized investment advice. It should not imply guaranteed prediction, accuracy or outperformance.
Frequently Asked Questions
Is Least Squares Moving Average a buy or sell signal?
No. Price above a rising LSMA is read as an uptrend and price below a falling LSMA as a downtrend. The endpoint is the most extreme part of the fit, so it is sensitive to the latest few prices and can overshoot at turns. A trade built on it still needs a trigger, an invalidation rule, a position size and realistic execution assumptions.
What is the best setting for Least Squares Moving Average?
Least Squares Moving Average takes these inputs: closing prices; window length n (such as 25); regression slope and intercept for the window. There is no universal best setting for the tunable ones, so test them across instruments, regimes and out-of-sample periods and favor stable parameter regions over one historical winner.
Can Least Squares Moving Average be used by itself?
The endpoint is the most extreme part of the fit, so it is sensitive to the latest few prices and can overshoot at turns. It assumes a straight-line trend within the window. For that reason it is read next to measures of direction, participation, valuation, liquidity and risk, not alone.
Does Least Squares Moving Average work on every timeframe?
The calculation (LSMA = intercept + slope * (n - 1), from a least-squares line fitted to the last n closes with x = 0 to n - 1) can be run on any bar size, but behavior is not portable: a reading on a five-minute chart describes a very different market window from the same reading on a daily chart. Validate the exact timeframe before relying on it.
Why does Least Squares Moving Average give false signals?
Noise in the last few bars changes the fitted slope for the whole window, so an outlier near the end shifts the output more than one at the start. Very short periods make the endpoint track price almost exactly, which removes most of the smoothing. Lag, noise and regime changes add to this, because market participants react to new information after the reading is calculated.
How should Least Squares Moving Average be backtested?
Rebuild Least Squares Moving Average from closing prices using point-in-time data, write the rules before testing, include delisted securities where relevant, model realistic fills and costs, reserve a validation sample and compare with a simpler baseline.