TREND, MOVING AVERAGES & STRUCTURE
Least-squares MA
A moving average built from a straight-line fit rather than a plain mean.
spec id: lsmalength (default 14)
What does Least-squares MA measure?
A moving average built from a straight-line fit rather than a plain mean. It is smoother than an average of the same length and lags less.
How is Least-squares MA calculated?
Fit a straight line through the last 14 closing prices, and read that line's value at today's candle.
Written by reading the engine’s real computation, not a textbook — where the two differ, the page describes what actually runs.
How do I use Least-squares MA in a bot?
In the builder, add an indicator of type lsma (parameters: length, default 14). Its value becomes an operand you can compare in any entry or exit rule. The engine grades the whole rule honestly: real fills, no look-ahead, half the history held back.
Related indicators
- McGinley dynamicA trend line that adjusts its own speed to the market, so it hugs price in fast moves instead of falling behind like a fixed-length average.
- Rolling medianThe middle closing price of the recent window.
- Median priceThe midpoint of a single candle — halfway between its high and its low.
- MidpointThe middle of the recent CLOSING range — halfway between the highest and lowest close.
Or browse all 158 indicators in the full library.