WiseTrader Toolbox

VariablePeriodCMO

Background

The Chande Momentum Oscillator (CMO), developed by Tushar Chande, is a pure momentum indicator. Over a look-back window it adds up all the gains and all the losses, then expresses the difference as a percentage of the total movement. The result oscillates between −100 and +100: high positive values mean upward momentum dominates, large negative values mean selling dominates, and readings near zero mean the market is range-bound. It is closely related to the RSI but is not smoothed, so it tends to reach extremes more readily.

A standard CMO uses a fixed look-back. VariablePeriodCMO takes a period for each bar, letting the window adapt to market conditions. The per-bar periods often come from an adaptor such as the DominantCycle.

Included formula

The toolbox ships a ready-made Adaptive Smoothed CMO indicator built on this function, so you can use it without writing any code. In AmiBroker open the Charts window, expand the WiseTraderToolbox group and drag Adaptive Smoothed CMO onto a chart.

It plots the CMO in its own pane below price, with optional threshold lines and a signal line. The Adaptor you pick is what produces the per-bar period this function needs — so the window adapts to the market — and an optional Smoother cleans up the input first. The adaptor's bounds, the thresholds and the colours are all set from the indicator's parameters.

The exported function

If you would rather build your own formula, the toolbox exports the calculation as a single AFL function you can call directly — it is the engine inside that indicator.

VariablePeriodCMO(Price, Periods)
ParameterDescription
Price The price array the indicator is calculated on.
Periods An array (or value) giving the CMO period to use at each bar. Most often this is fed from an adaptor such as the DominantCycle.

Usage

periods = DominantCycle( Close );
cmo = VariablePeriodCMO( Close, periods );
Plot( cmo, "Adaptive CMO", colorRed );
Plot( 50, "", colorGrey40, styleDashed | styleNoLabel );
Plot( -50, "", colorGrey40, styleDashed | styleNoLabel );
Note

The oscillator ranges from −100 to +100. Levels of ±50 are often used as overbought / oversold thresholds, and the zero line as a momentum sign change.