2006issue C011-7
Building custom indicators from the Commodity Channel Index, a least squares moving average and a rule-based entry
A custom oscillator can be formed by subtracting a reference average from the close, then combining Commodity Channel Index and least squares moving average filters into a scored trigger. Those conditions are frozen as one rule-based entry so the construction can be prototyped and backtested as a full strategy rather than treated as a finished trading method.
- A custom oscillator can be built by subtracting an 18-period average of the close from the close, then overlaying a short smoother and a zero line so a central-line cross is the same event as a price-versus-average cross.
- Lookback length and the chosen price or volume series change an indicator's values without rewriting code, and a three-to-seven-period smoother lets crosses of the raw line versus the smoothed line be treated as candidate signals.
- One scored trigger combines a 50-period Commodity Channel Index, a 14-period Commodity Channel Index, a 34-period exponential moving average and a 25-period least squares moving average, and the rule-based entry fires only when every listed buy or sell condition is met.
- Structured programs split a header, a calculation module and plotting instructions so extra trigger conditions can be stacked by changing inputs or slightly extending the same code.
Isolate a price-to-baseline residual
A custom oscillator can be built by subtracting a reference series, such as an 18-period average of the close, from a dependent series such as the close, then overlaying a short smoother and a zero line so a central-line cross is the same event as a price-versus-average cross.
Change inputs without rewriting the code
Input variables such as lookback length and which price or volume series is used change an indicator's values without rewriting code, and a three-to-seven-period smoother is commonly plotted over a noisy series so crosses of the raw line versus the smoothed line can be treated as candidate signals.
Normalize the Commodity Channel Index on a fixed scale
Commodity Channel Index constructions are presented as normalized oscillators on a fixed scale so common overbought and oversold thresholds can be compared across markets.
Combine the filters into buy and sell trigger bands
One trigger construction combines a 50-period Commodity Channel Index, a 14-period Commodity Channel Index, a 34-period exponential moving average, and a 25-period least squares moving average to set buy and sell trigger bands.
Freeze the listed conditions as one rule-based entry
The rule-based entry fires when Commodity Channel Index readings are above zero and the close has crossed above both moving averages, sending the indicator into a buy-trigger zone. The opposite conditions define the sell-trigger zone.
A reading of plus or minus 4 on that trigger is defined as the state in which every listed condition has been met, while lesser extremes are treated only as proximity to the user-defined opportunity, not as a completed signal.
Split the program into header, calculation and plot
Structured indicator programs are split into a header that binds inputs and variables, a calculation module that applies platform functions, and plotting instructions that choose what to display, so the same procedure can be reused when extra trigger conditions are added.
Prototype a full strategy from the custom indicators
The construction is offered as a way to prototype and backtest a full strategy from custom indicators rather than as a finished trading method. Extra conditions can be stacked by changing inputs or slightly extending the same code.
Trigger score with +3 / −3 entry bands

The demonstration freezes four ±1 switches: 50-period CCI above zero, 14-period CCI above zero, close above a 34-period exponential average, and close above a 25-period least-squares average. The sum can only be −4, −2, 0, +2 or +4. Plateau widths are approximate.
All readings on this track · 39 readings
- 1982Three gates on a 1982 pork-belly short
- 1982Scale-free Commodity Channel Index construction
- 1986Constructing a commodity channel index and a regression price channel
- 1987Constructing scaled OHLC matrices for study overlays
- 1987Constructing the commodity channel, average directional, and relative strength indexes on a shared cycle scale
- 1992Eleven-bar commodity channel index from typical price and mean deviation
- 1992Evaluating Commodity Channel Index breakout versus range rules
- 1992Evaluating breakout and CCI rules as complete mechanical procedures
- 1993Constructing stochastic, RSI and CCI inputs for forecasts
- 1993Nested centered channels with a commodity channel index confirmation gate
- 1993Listed-option timing as three separable clocks
- 1994Constructing an eleven-period commodity channel index
- 1994Confirming Elliott wave turns with channels and the commodity channel index
- 1995Commodity Channel Index band rules lag zero-line timing
- 1995Building the commodity channel index from typical price
- 1995Staged reversal rules with commodity channel index and average channels
- 1995Commodity channel index construction from typical price to a smoothed zero line
- 2001Reader tests for unfinished lookback oscillators
- 2002Constructing the commodity channel index from typical price
- 2003Breadth-filtered commodity channel index entry and exit rules
- 2003Constructing the Commodity Channel Index from typical price and scaled deviation
- 2003A shallow, poorly participated advance is an unconfirmed trend
- 2003CCI and RSI parameter defaults as scaling conventions
- 2003A cost and capital audit of a Commodity Channel Index trade engine
- 2003Commodity channel index peak divergence as an exit after twin patterns
- 2004Constructing the Commodity Channel Index from typical price
- 2004Constructing the Commodity Channel Index from typical price and mean deviation
- 2006Building custom indicators from the Commodity Channel Index, a least squares moving average and a rule-based entry
- 2012Confirming breakouts and retracements with CCI, ADX, and averages
- 2012Stacking oscillator lookbacks into a heatmap mosaic
- 2013Constructing a consensus and volatility-normalized value oscillator
- 2013Walk-forward system evaluation with a commodity channel index and chandelier exits
- 2014Dual detrended oscillators and dual Bollinger Band channels
- 2014RSI, CCI, and moving-average trend-filter construction
- 2014Dual RSI, a moving average, and CCI as a confirmation stack
- 2017Constructing dual-average cross and channel-index filters
- 2018Treat CAM as a classification layer before confirmation becomes an entry
- 2018Four-state slope labels gated by a moving average and a commodity channel index
- 2018Deviation-Scaled Moving Average construction from a two-bar difference