Skip to main content
Track Trend filter
16 / 33
Library

2005issue C021

Three-state moving-average breakout bar coloring

This construction builds a moving-average trend-filter from a chosen length, offset, price source, and averaging type, then assigns each bar one of three color states according to whether its full range clears that baseline.

  • Build the moving-average from a chosen length, offset, price source, and averaging type, then classify every bar against that trend-filter.
  • Record a breakout only when the bar's entire high-low range sits above or below the baseline.
  • Assign a third overlap-state color when the bar straddles the baseline.
  • Apply the same three-state rule to price-bar-coloring and to a paired histogram.
Entries in this reading3 entries

What this construction does

The study builds a moving-average baseline from a user-chosen length, offset, price source, and averaging type, then classifies each bar against that baseline.

The moving-average is a smoothed baseline computed from the chosen price source, lookback length, offset, and averaging type. That level is the trend-filter: it classifies each bar as fully above, fully below, or overlapping the baseline.

Inputs that define the baseline

The length parameter has a lower bound of 1 and a default of 20, and the offset defaults to 0.

The average can be computed from close, high, low, open, the high-low midpoint, the high-low-close typical price, or the open-high-low-close average.

Averaging type can be simple, exponential, weighted, or volume-weighted, with simple as the default.

The three-state breakout rule

A breakout is a bar whose entire high-low range sits on one side of the moving-average baseline.

A bar is treated as a positive directional breakout when its low is entirely above the moving average.

A bar is treated as a negative directional breakout when its high is entirely below the moving average.

When a bar neither clears above nor clears below the average, the construction assigns a third, non-breakout color state. That is the overlap-state, the condition in which a bar straddles the baseline, so neither a full upside nor a full downside clearance is recorded.

How the states are drawn

The same three-state classification is applied to overlay price-bar color and to a paired histogram plot.

Price-bar-coloring is that mapping of the three classification states onto displayed bar color and a companion histogram.

Educational research material, not investment advice. Historical source context does not establish present-day performance.
16 of 33 in the Trend filter track
20051-4 pp.Next on Trend filterConstructing a volume and move-adjusted trend filterAn average of closes, with any lookback or any linear or exponential decay, only locates the history of the series and does not, by itself, state a future direction.
All readings on this track · 33 readings
  1. 1988Opening-range brackets, a two-bar trend filter, and bounded stops
  2. 1990Bezier-curve price trend filter
  3. 1992Constructing a damping-index trend filter
  4. 1992Building a random walk index trend filter
  5. 1992Phase diagrams for moving-average trend filters
  6. 1993Volume-weighted change smoothing and trend ranking
  7. 1993Concurrent highest-low filter with a largest-low-fall trigger
  8. 1994Unit-invariant trend filters and the c-test
  9. 1995Constructing cup and cap entries with a three-bar net line
  10. 1997Why a daily timing evaluation depends on interval, lookbacks, and the fitting objective
  11. 2001A volume budget clock for trend-segment construction
  12. 2001Keep three jobs separate when you test a composite score
  13. 2002Evaluating the weekly four-percent close filter as a market-state procedure
  14. 2003Constructing a confirmed zigzag trend filter
  15. 2004Decompose high, low, and close into separate forecast streams
  16. 2005Three-state moving-average breakout bar coloring
  17. 2005Constructing a volume and move-adjusted trend filter
  18. 2005A fifty-day average breakout as a trend permission filter
  19. 2005Current-bar inclusion can mute a stochastic channel break
  20. 2006A stochastic oscillator gated by a long-term exponential average
  21. 2010A construction test for a modified volume-price trend filter
  22. 2011Constructing a Spearman rank trend filter
  23. 2013Constructing a repeated-median slope as a resistant trend filter
  24. 2014Combining a relative-strength index and trend filters for oversold setups
  25. 2014Price-rooted lookbacks for a relative strength index, a moving average, and a trend filter
  26. 2015Evaluating next-session intermarket range forecasts
  27. 2018Read the intermarket weight matrix first, then the predicted moving-average filter
  28. 2018Constructing the stiffness trend filter from moving-average holds
  29. 2018The averaging kernel and the lagged trend gate are separate specifications
  30. 2019A trend filter is not ready to compare until portfolio constraints are written down
  31. 2019Lookback, threshold, and position-capacity for a stiffness trend-filter
  32. 2020Combining a trend filter with a moving average and a stochastic oscillator
  33. 2020Constructing a relative-strength oscillator with a rank-agreement trend filter
All 137 readings tagged Trend filter
Also on Trend filter5 readings