Skip to main content
Track Adaptive moving average
11 / 24
Library

2001issue C091-6

Encoding candle structure as a numeric filter

One CandleCode construction turns each bar into a single score by weighting body color, body size, shadows, and gap. After double smoothing, that score can be read with a threshold crossing or with Bollinger band crossings.

  • CandleCode assigns separate integer weights to body color, body size, upper shadow, lower shadow, and gap, then adds those signed components into one bar score.
  • A double-smoothed CandleCode series can define a long or short through a threshold crossing at replaceable levels, or through a band crossing on Bollinger envelopes built from the same series.
  • The encoded series can be plotted raw, single-smoothed, double-smoothed, or as a CandleCode oscillator that uses a zero-line cross as a scan condition.
  • The MESA adaptive moving average can be plotted with a slower following adaptive moving average as a two-line overlay on price.
Entries in this reading3 entries

A weighted score for each bar

One CandleCode construction assigns separate integer weights to body color, body size, upper shadow, lower shadow, and gap, then adds those signed components into a single bar score.

The body-color weight is added for an up candle, subtracted for a down candle, and omitted when open and close are equal. The body-size component scales with how large the candle body is, from a large down body to a large up body. Each shadow component is the bullish increment from an upper shadow or the bearish decrement from a lower shadow, and both are zero when that shadow is absent. The gap component is the signed increment for the distance between the current open and the prior close.

Example weights

In the worked weighting example, body color and body size each use 32, each shadow uses 16, and the gap uses 8. A white body adds 32, a black body subtracts 32, and an unchanged body contributes nothing from color.

Under those same example weights the body-size component ranges from -32 to +32, each shadow component ranges from 0 to 16 in absolute value, and the gap component ranges from -8 to +8.

Threshold crossing after double smoothing

A turning-point rule can be built by double-smoothing CandleCode with successive averages of 21 and 3 bars. The double-smoothed CandleCode series can then be read more slowly than the raw score.

A long is taken when that series crosses above 50, and a short is taken when it crosses below 70. Those levels are replaceable examples of a threshold crossing.

Band crossing on the same series

A second rule keeps the same 21-then-3 double-smoothed CandleCode series but replaces the fixed levels with 20-period, 2-deviation Bollinger envelopes. It goes long on a cross above the lower band and short on a cross below the upper band.

That band crossing uses envelopes built from the encoded series itself rather than from a separate price line.

Ways to plot the encoded series

The encoded series can be plotted raw, single-smoothed, double-smoothed, or as a CandleCode oscillator equal to the difference between the single-smoothed and double-smoothed lines.

Readings from a small sample

On a small sample of three-minute bars, slope changes of the double-smoothed line in extreme territory and oscillator crosses of the zero line were described as the most useful leading readings.

A scan can treat a CandleCode oscillator move from below zero to at or above zero as a buy condition and the opposite cross as a sell condition.

CandleCode band-crossing net return versus buy-and-hold

Long-only CandleCode band crossings returned 100.1 percent over the published three-year Wealth-Lab run, and the short sleeve added nothing. Buy-and-hold made a larger raw 145.8 percent. These figures are the Profit/Loss percent row of the system-results table, not a redraw of an equity curve.
Long-only CandleCode band crossings returned 100.1 percent over the published three-year Wealth-Lab run, and the short sleeve added nothing. Buy-and-hold made a larger raw 145.8 percent. These figures are the Profit/Loss percent row of the system-results table, not a redraw of an equity curve.12 Nasdaq-100 stocks · 3-year simulation

The test dropped short trades after they reduced stock results, set Bollinger deviations to 2.0, started at $50,000 with a $5,000 base size, and used 12 randomly chosen Nasdaq-100 names.

Adaptive averages as a price overlay

The MESA adaptive moving average can be implemented as an external library routine and plotted with a slower following adaptive moving average as a two-line overlay on price.

Educational research material, not investment advice. Historical source context does not establish present-day performance.
11 of 24 in the Adaptive moving average track
20011-4 pp.Next on Adaptive moving averageAdaptive averages driven by cycle-phase speedAn exponential moving average is made adaptive by tying its smoothing coefficient to the measured bar-to-bar cycle-phase increment instead of to price volatility.
All readings on this track · 24 readings
  1. 1991Building variable-length moving averages from partitioned price changes
  2. 1991Variable-length moving average from change dispersion
  3. 1992Constructing volatility-adaptive exponential smoothing
  4. 1995Constructing an adaptive moving average with an efficiency ratio and filter
  5. 1995Two-gate breakout confirmation with adaptive averages
  6. 1995Building momentum-scaled adaptive moving averages
  7. 1995Adaptive length as a construction choice inside exponential smoothing
  8. 1998Testing price-channel breakouts with a lag-aware adaptive average
  9. 1998Constructing filters by nesting offsets and variable weights
  10. 1998Constructing an efficiency ratio adaptive average and entry filter
  11. 2001Encoding candle structure as a numeric filter
  12. 2001Adaptive averages driven by cycle-phase speed
  13. 2005Constructing an adaptive moving average from a fractal-dimension weight
  14. 2005Range-dimension adaptive exponential filter
  15. 2010Constructing simple, exponential, and adaptive averages
  16. 2010How a price-hugging smoother is assembled from ordinary averages
  17. 2013Evaluating an adaptive moving average against a same-window moving average
  18. 2016Three-layer confirmation: adaptive average, stochastic relative strength index, and stop-and-reverse
  19. 2017One-alpha reverse-path exponential smoothing
  20. 2018Pair two adaptive averages to filter swing turns
  21. 2018Two Adaptive moving averages as a confirmation pair
  22. 2018Constructing an adaptive filter for adoption-cycle reversals
  23. 2018Constructing a deviation-scaled adaptive moving average
  24. 2020Walk-forward and adaptive averages as two tests of the same trend
All 28 readings tagged Adaptive moving average
Also on Adaptive moving average5 readings