Skip to main content
Track Moving average
6 / 15
Library

2000issue C011-3

Constructing a slope-corrected moving average

A modified moving average is assembled from a simple average of a chosen price series over a stated lookback, then adjusted by a slope term so the construction can offset the lag that the unadjusted average of the same lookback typically introduces.

  • A modified moving average is a simple average of a chosen price series over a stated lookback, plus a scaled slope correction computed from the same observations.
  • The slope sum is a weighted accumulation of current and lagged prices that estimates local direction for the correction term.
  • Short-lookback reductions keep the same two-part structure, with the slope correction collapsing to a momentum term divided by two.
  • When the lookback is longer than three bars, a looped or parameterized implementation replaces a fully expanded formula.
Entries in this reading1 entry

Write the lag into the construction

A modified moving average is assembled from a simple average of a chosen price series over a stated lookback, then adjusted by a slope term. That slope correction lets the construction offset the lag that the unadjusted average of the same lookback typically introduces.

TradersWeek editorial: treat lag as a written term in the construction, a simple-average level plus an explicit slope correction, rather than a hidden property of the plotted line.

Form the slope sum

The slope term is formed by looping across the lookback and weighting each lagged price by one-half of the lookback minus an odd-numbered factor. That odd-numbered factor starts at 1 and increases by 2 at each older bar.

The resulting slope sum is a weighted accumulation of current and lagged prices that estimates local direction for the correction term. Lookback length is the number of sampling intervals used for both the simple average and the slope weights.

Finish the modified average

The finished value equals the simple average plus six times the slope sum, divided by the product of the lookback and one plus the lookback.

Call it from a plot routine

Wrapping the construction as a function of price and length lets a separate plot routine call it with defaults of the close and a two-bar lookback, scaled like the underlying series.

Check the short-lookback reductions

For a two-bar lookback the construction reduces to a two-bar simple average of the close plus one-half of a one-bar momentum. For a three-bar lookback it reduces to a three-bar simple average plus one-half of a two-bar momentum.

Those short-lookback reductions are algebraically collapsed forms of the same construction, in which the slope correction becomes a momentum term divided by two.

Use a loop when the lookback grows

Expanded forms for four-, eight-, and ten-bar lookbacks keep the same two-part structure: a simple average plus a linear combination of the current close and successively lagged closes, scaled by the product of the lookback and one plus the lookback.

When the lookback is longer than three bars, writing every lag weight by hand becomes cumbersome, so a looped or parameterized implementation is used instead of a fully expanded formula.

A four-bar worksheet form

A four-bar worksheet form computes the simple average, a four-term weighted sum of the current close and the prior three closes, applies the six-over-(period-plus-one)-times-period adjustment, and can store the residual of close minus that modified average.

Educational research material, not investment advice. Historical source context does not establish present-day performance.
6 of 15 in the Moving average track
20001-3 pp.Next on Moving averageLookback length as a construction check for the modified moving averageA published default length of 2 for a modified moving average can make the average plot identically to a one-line close-price series.
All readings on this track · 15 readings
  1. 1990Building a percent-difference moving-average oscillator
  2. 1991Ease of movement oscillator construction
  3. 1993A twelve-month moving-average filter for inflation direction
  4. 1993Constructing two-endpoint JSA moving averages
  5. 1999Centered moving averages for trend construction
  6. 2000Constructing a slope-corrected moving average
  7. 2000Lookback length as a construction check for the modified moving average
  8. 2001Smoothing balance of market power with a moving average
  9. 2005Three-state moving-average directional breakout construction
  10. 2005Constructing a move-adjusted moving average
  11. 2005Moving-average construction: windows, weights and stops
  12. 2008Constructing stacked moving-average filters
  13. 2011Constructing percentage-offset moving-average bands
  14. 2015Linearity, commutation, and ratio smoothing in moving averages
  15. 2019Constructing a 50-200 sma-channel for swing entries and exits
All 449 readings tagged Moving average
Also on Moving average5 readings