Extra indicators

LSMA: Least Squares Moving Average

The end point of the straight line that fits the last N closes best: a moving average that follows the slope.

2 min read · Try it on a live chart ↗

The idea in plain words

Instead of averaging, LSMA fits a straight line through the recent closes (linear regression) and takes where that line ends today. In a steady trend it sits almost on the price.

How it is calculated

For the last N closes, find the line a + b·k with the smallest squared distances (least squares) and plot its value at the newest candle.

b = (N Σk·y − Σk Σy) ÷ (N Σk² − (Σk)²),  a = (Σy − b Σk) ÷ N
LSMA = a + b × (N − 1)

How to use it

  • As a responsive trend line.
  • The slope (rising or falling) shows the direction of the last N candles.

Drawing conclusions

  • When the price moves far away from LSMA the trend is accelerating; returning to it means it is fading.

Example

EURUSD H1, LSMA(25): during a steady climb the line almost touches every close; the first close well below it signals the climb has broken.

Prices in examples are illustrative.

Watch out for

  • It reacts fast and therefore overshoots at turning points.

A little history

Linear regression goes back to Legendre and Gauss (early 1800s); traders adopted the rolling version in the 1980s and 1990s.

Educational content only. No indicator or pattern predicts the future, and nothing here is investment advice.