Concept
LSMA
LSMA, also known as least-squares MA, linear-regression value, endpoint MA/EPMA, Time Series Forecast/TSF, is a Trend concept. A reference entry: the Library explains it rather than implements it.
What is LSMA?
LSMA, the least-squares moving average, fits a straight line to the last N closes by ordinary least squares (linear regression) and plots the value of that line at the current bar. Slide the window one bar, refit, plot again: the indicator is the running sequence of regression endpoints, which is why it is also called the endpoint moving average or linear-regression value; the Time Series Forecast is the same fit projected one bar ahead on some platforms. Because a fitted line may tilt, its endpoint can sit beyond every price in the window, something no positively weighted average can do, and that is where its speed comes from.
Two identities make its behavior legible. Algebraically, LSMA = 3 × WMA − 2 × SMA of the same length: it extrapolates the weighted average past the simple one. Written as a single weighted average, its oldest bars carry negative weights, which is what lets the line lead at turns and also why it overshoots after sharp moves and can jump when a large old bar falls out of the window. Responsiveness and overshoot are the same property seen from two sides.
The mathematics is far older than charting software: least squares goes back to Legendre and Gauss in the early 1800s, and analysts fitted regression lines to price by hand long before terminals did. The moving-average form has been in the technical toolkit since at least the mid-1990s, when Patrick Lafferty described the endpoint moving average in Technical Analysis of Stocks & Commodities; platform studies named Least Squares Moving Average, Moving Linear Regression, and Time Series Forecast implement the same idea under different labels. In effect the LSMA automates extending a trendline through recent closes, with the fit recomputed objectively on every bar.
The appeal is where the lag budget goes. A same-length EMA or simple average must trail price because all of its weights are positive; the LSMA's fitted slope lets it hug turns and cross price sooner, so slope flips and crossings fire earlier. The cost is a different failure mode: overshoot past stalls, jumps when an outlier bar leaves the window, more false flips in sideways tape. Choosing it is choosing which errors to accept, so judge it side by side against conventional averages; zero-lag variants in the library push the same trade-off further in the fast direction.
How to calculate LSMA
One regression per bar:
- 1Take the last N closes and fit the least-squares line, the line minimizing the sum of squared vertical distances to those closes.
- 2Record the fitted line's value at the newest bar; that value is the LSMA for this bar.
- 3Shortcut: the same number equals 3 × WMA(N) − 2 × SMA(N), so no explicit regression is needed.
- 4Advance one bar and repeat. Each bar keeps its own window's endpoint, so plotted history does not change.
- 5Sanity-check by overlaying a same-length SMA: the LSMA hugs turns and pokes past price after steep runs while the SMA lags evenly.
How it's calculated
The value at the current bar of a least-squares line fitted to the last n prices, refitted and replotted on every bar as a moving average.
Also known as endpoint MA (EPMA) or linear regression value: only the regression line's endpoint is kept each bar.
Time Series Forecast (TSF) versions project the same line one bar ahead: TSF_t = LSMA_t + b.
It hugs price more closely than an SMA or EMA of equal length and can overshoot at turning points.
How traders use it
- As a fast trend line: price/LSMA crossings and slope changes trigger earlier than same-length conventional averages, with the standard toll of extra false starts in chop.
- As the live midline of regression tooling: a linear-regression channel's midline evaluated at the current bar is the LSMA, so distance from it doubles as a stretch measure for reversion trades.
- As the fast leg in moving average crossovers: pairing a short LSMA against a slower conventional average keeps entries early while the slow line vetoes part of the noise.
- As a smoother for other series: an LSMA of an RSI or of volume keeps turns sharp where a simple average would round them off, and overshoot matters less on bounded oscillators.
- As a slope proxy: because the endpoint embeds the fitted slope, bar-to-bar change in the LSMA approximates the regression slope without computing it separately, feeding the same logic as an MA slope filter.
- As a rail for dynamic support and resistance: pullbacks to a rising LSMA are traded like tests of any moving average, though overshoot makes it a less stable reference near sharp reversals.
LSMA vs related tools
EMA: All-positive, geometrically decaying weights, so it can only lag price, never lead it. LSMA's negative old-bar weights buy lead time and pay for it with overshoot.
SMA: The equal-weight benchmark and one of LSMA's own ingredients. An N-period SMA lags by about (N − 1)/2 bars; the LSMA spends that budget fitting a slope instead, turning sooner but wiggling and overshooting more.
Ehlers SuperSmoother: A filter-theory answer to the same lag problem: it suppresses short-wavelength noise with minimal delay rather than extrapolating a fitted line. The SuperSmoother stays calm and rounded; the LSMA stays fast and pointed.
Concept family
Trend
100 concepts mapped · 100 in the Library
LSMA FAQ
Are LSMA and linear regression the same thing?
Same math, different plot. A linear-regression study draws the whole fitted line (or channel) across the lookback and refits it as bars arrive, so the drawing moves. LSMA keeps only the fitted value at each bar's own endpoint and strings those values together, so it reads as a moving average and its history never changes once printed.
Why does LSMA overshoot after sharp moves?
The fit projects the window's slope onto the newest bar, and expressed as a weighted average the oldest bars carry negative weights. After a steep run the fitted slope stays tilted while price stalls, so the endpoint keeps extending before snapping back. The same mechanics let it turn quickly; you cannot keep the speed and remove the overshoot.
What is a good LSMA length?
There is no canonical setting; platform defaults vary. Shorter windows track turns tightly and overshoot hardest, while longer windows behave more like a smooth trend line with the characteristic lead at inflections. A reasonable procedure is to match the window to the swing length you trade, then compare against an EMA of similar responsiveness to see which failure mode costs less.
Does the LSMA repaint?
No. Each bar's value is the endpoint of that bar's own regression window and never changes once the bar closes. Confusion comes from full regression lines and channels, which redraw across the window as bars arrive; the LSMA is the non-repainting, bar-by-bar sampling of those fits.
What is the difference between LSMA and the Time Series Forecast?
Same regression, different evaluation point. LSMA plots the fitted line at the current bar; the Time Series Forecast evaluates it one bar ahead, adding the slope once more. TSF is therefore slightly faster and slightly more overshoot-prone, and on most charts the two lines are near-identical.
Turn LSMA into a trading strategy.
Describe your LSMA idea to Quant. It builds the strategy with you and backtests it on real data.