Skip to main content
Track Weighted moving average
16 / 20
Library

2003issue C011-4

Same-scale trend filter from a rolling least-squares endpoint

A moving-trend keeps the current-bar value of a least-squares line fitted to the last n observations. That endpoint is also a mixed-sign weighted sum that still sums to one, so a same-window moving-average can sit beside it and show lag, scale, and smoothness as choices in the weights.

  • A moving-trend is the current-bar value of a least-squares line fitted to the last n observations and recomputed as the window advances.
  • The endpoint has a closed form in the window length n, the unweighted sum of those prices, and the time-weighted sum that multiplies the same prices by 1 through n.
  • For n = 5 the chronological weights are -1/5, 0, 1/5, 2/5, and 3/5. They include a negative term, sum to one, and keep the series on the original price scale.
  • The same construction can be run on close-only, midrange, or open-high-low-close inputs and then used as a surrogate-series for ordinary tools, including candlestick rendering.
Entries in this reading3 entries

How the moving-trend is formed

A moving-trend is built by fitting a least-squares line to the most recent n observations, storing that line's value on the current bar, and repeating the fit as the window advances. The result is a trend-filter: a rolling construction that estimates the current level from the recent slope of ordered prices instead of from a lagged central average of those prices.

The current-bar endpoint has a closed form that uses only the window length n, the unweighted sum of the n prices, and the time-weighted sum that multiplies those prices by 1 through n.

A same-window average locates an earlier midpoint

A simple five-bar moving-average is described as locating the market two and a half bars earlier, while the same-length moving-trend is treated as a forecast of today's level rather than as lagged data. A moving-average, in this terminology, is an equal-weight smoother of the same window whose positive coefficients locate a past midpoint of the sample rather than today's fitted endpoint.

Exponential weighting of a moving average is described as reducing that lag without removing it, so the moving-trend endpoint is a different construction rather than a faster average of the same type.

The endpoint as a weighted-moving-average

The regression endpoint equals a weighted sum whose chronological weights are each index k minus (n+1)/3, then multiplied by 6/(n(n+1)), so some weights are negative. That rewrite is a weighted-moving-average: a linear combination of the same ordered observations in which the coefficients may be unequal and may change sign.

For n = 5 those weights are -1/5, 0, 1/5, 2/5, and 3/5, which match the five-bar moving-trend and can be coded as a weighted moving sum without a regression routine.

A hybrid that stays on the price scale

The construction is not a conventional moving average, whose coefficients are positive and sum to one, and not an oscillator, whose coefficients sum to zero. It is a coefficient-hybrid: a weight vector that sums to one, like an average, while including negative terms, like an oscillator, so the output stays on the original scale.

The series can be computed on close-only, midrange, or open-high-low-close inputs and then used as a same-scale surrogate on which ordinary technical tools, including candlestick rendering, are applied. That output is a surrogate-series: filter output kept near the original price scale and then treated as a stand-in close, midrange, or full bar for other tools.

A related seven-bar weighted smoother uses mixed-sign chronological weights and, if those weights are divided by the sum of their absolute values, produces a differently scaled series that can be renormalized for comparison with a five-bar moving-trend.

Educational research material, not investment advice. Historical source context does not establish present-day performance.
16 of 20 in the Weighted moving average track
20031-11 pp.Next on Weighted moving averageHow a rolling linear-regression endpoint is assembled as a moving-trendA moving-trend is the current-bar value of a linear-regression of close over a fixed lookback, used as a price smoother rather than as a lagged average.
All readings on this track · 20 readings
  1. 1988Indicator smoothing: lookback, weight, and scale
  2. 1990Recency weighting in simple, linear, and exponential moving averages
  3. 1990Seed and recurrence construction for moving averages
  4. 1990Constructing a five-day step-weighted moving average
  5. 1992Constructing simple, weighted, and exponential moving averages
  6. 1992Constructing moving averages with weighting schemes and extra filters
  7. 1992Constructing a weighted-average TRIN10 with Bollinger envelopes
  8. 1992Constructing a banded weighted open-TRIN oscillator
  9. 1993Evaluating a weighted dual rate-of-change momentum filter
  10. 1993Constructing equal, linear and exponential moving averages
  11. 1993Constructing a general weighted moving average from one exponent
  12. 1993Calibrating the weighted-moving-average exponent
  13. 1993Constructing an exponent-weighted average of put-call ratios
  14. 1994Cycle-tuned momentum with spectral peaks
  15. 1999How a five-bar sine-weighted average is assembled
  16. 2003Same-scale trend filter from a rolling least-squares endpoint
  17. 2003How a rolling linear-regression endpoint is assembled as a moving-trend
  18. 2004Constructing a volume-weighted moving average as a forecast baseline
  19. 2005Constructing a move, volume and recency weighted average
  20. 2016MACD as a zero-line filter with dual moving averages
All 24 readings tagged Weighted moving average
Also on Weighted moving average5 readings