LSMA Indicator: Formula, Settings and How to Read It
LSMA (least squares moving average) fits a straight line through the last N closes by least squares and plots the value of that line at the current bar. It is also known as the linear regression line, and Senzoukria uses a default period of 25, the default of TradingView's linreg function.
Senzoukria · Indicators · Updated September 2026
LSMA ships with the Senzoukria desktop app, in the Averages & volatility group of the indicator catalogue. It is drawn on the price chart.
What LSMA measures
For each bar the indicator solves for the intercept and the slope that minimise the squared distance between the fitted line and the N closes in the window, then reports the endpoint of that line rather than an average of the values. Since a least-squares line passes through the mean of its window at the midpoint, the endpoint equals the simple average of the same closes plus the slope multiplied by (N-1)/2. In a directional window the LSMA therefore sits ahead of an SMA of the same length, and in a flat one the two nearly coincide. No value is produced until N bars are available.
The formula, as implemented
This is not a description of how the indicator is usually defined elsewhere — it is what the shipped code computes, documented next to the implementation:
LSMA — Least Squares MA (alias régression linéaire, TradingView `linreg(close, N, 0)`) : fit y = a + b·t (moindres carrés) sur la fenêtre N ; LSMA[i] = a + b·(N−1) — la valeur de la DROITE au point courant. Warm-up (< N barres) → null. Défaut N=25 (le défaut TradingView).
How to read it
- Read the line as the recent trend evaluated at the current bar, not as a central value: in a directional move it can sit outside the middle of the price range.
- A change in the slope of the line means the fit itself has reversed, which takes more than one bar going the other way.
- When price oscillates around a nearly horizontal LSMA, the fitted trend over the last 25 bars is flat and the crossings carry no direction.
- The fit is recomputed from scratch on every bar, so the line can shift noticeably when one extreme bar enters or leaves the window.
Parameters and defaults
Period defaults to 25 with a minimum of 2 and a maximum of 500. A short window makes the fit follow short swings and the endpoint swing with them; a long window gives a stable slope that reverses only after a sustained change. At the minimum of 2 the fitted line passes exactly through both closes, so the plotted endpoint is the current close. The calculation uses the close and has no source selector.
| Parameter | Type | Default | Range |
|---|---|---|---|
| Period | number | 25 | 2 – 500 |
What it does not show
A least-squares fit assumes the window is well described by a straight line, which is false around a turning point: after a sharp reversal the endpoint can keep projecting the old direction for several bars, then correct abruptly. The construction also allows the line to print above every close in the window during a steep advance. Every bar of the window counts equally in the squared error, so a single outlier tilts the slope, and that tilt is multiplied by (N-1)/2 at the endpoint, which is where the line is read.
Using it in Senzoukria
Add it from the Indicators panel of any footprint chart or candle chart. It runs on futures data from Rithmic or Databento and on crypto pairs from Binance and Bybit, on the same engine — the calculation does not change with the venue, only the data feeding it does. Market data subscriptions are billed by the provider, separately from the app.
Related indicators
- SMA — Averages & volatility
- EMA — Averages & volatility
- WMA — Averages & volatility
- Hull MA — Averages & volatility
- ATR (Wilder) — Averages & volatility
- Bollinger — Averages & volatility
See the full indicator library, or start with the order flow guide if you are new to reading aggression, delta and absorption.
Frequently asked questions
- What does LSMA stand for?
- Least Squares Moving Average. It fits a regression line through the closes of the last N bars by minimising the sum of squared residuals, then plots the value of that line at the current bar. It is the same calculation as a linear regression indicator reporting its endpoint, with a default window of 25 bars here.
- Is the LSMA the same as a linear regression line?
- The fit is identical: both minimise the squared distance to the closes over the window. What differs is the display. A regression channel draws the fitted segment across the whole window, while the LSMA keeps only its terminal point and repeats that computation on every bar, which produces a continuous curve.
- Why is the default LSMA period 25?
- It matches the default of TradingView's linreg function, so a chart configured elsewhere with the standard value reads the same here. The period accepts anything from 2 to 500: shorter windows follow swings, longer ones stabilise the fitted slope.