TradingCharts

Least Squares Moving Average

Trade slope flips: LSMA turning upward is a momentum buy cue, turning downward a sell cue.

What it does

The Least Squares Moving Average (LSMA), also called the endpoint moving average or linear regression curve, plots the endpoint value of a linear regression fitted to the last N bars, recalculated every bar. Because the regression projects the best-fit line to the current bar, the LSMA tracks price with very little lag and its slope directly reflects the fitted trend. It behaves like a moving average that leans in the direction of the trend.

Typeoverlaydraws on the price chart

How to add it

Click Indicators (ƒx) in the header.

Search “Least Squares Moving Average” and click the result.

Hover its legend row and click the gear to open settings.

How traders use it

  • Trade slope flips: LSMA turning upward is a momentum buy cue, turning downward a sell cue.
  • Use price crossing the LSMA as an early trend-change trigger, faster than the equivalent SMA or EMA cross.
  • Pair a short LSMA with a longer standard MA to combine early signals with a stable filter.
  • Watch the gap between price and the LSMA: unusually large gaps mark short-term overextension likely to snap back.

Inputs

Input Type Default Range / Options
Period number 25 2–500
Source select close Close / Open / High / Low / HL2 / HLC3 / OHLC4
Offset number 0 -500–500

Plots & styling

Plot Style Default color
LSMA(25) line #2196F3

Every plot's color, line width and visibility can be changed on the Style tab. Precision, price-scale labels and status-line values are configurable at the bottom of the Style tab.

Tips

  • Its price-scale label can be switched off per-indicator at the bottom of the Style tab if the axis gets crowded.
  • Drag the indicator to its own pane from the legend ⋯ menu if it crowds the price chart.
  • Double-click any of its lines to jump straight into the settings dialog.

Watch out for

  • Low lag brings noise: LSMA whipsaws in ranges and can overshoot around sharp turns because the regression extrapolates the recent slope.
  • Signals based on tiny slope changes are fragile and need confirmation from structure or volume.