Momentum OscillatorsPine Script v6

ta.cmo()Chande Momentum Oscillator

Calculates the difference between the sum of recent gains and the sum of recent losses and then divides the result by the sum of all price movement over the same period.

Syntax

Syntax
ta.cmo(series, length) → series float

Arguments

ParameterTypeDescription
seriesseries int/floatSource series for momentum measurement.
lengthseries intLookback length for summing up/down moves.

Returns

Chande Momentum Oscillator.

Remarks

na values in the source series are ignored.

Code Examples

Pine Script v6 Example
//@version=6
indicator("ta.cmo")
plot(ta.cmo(close, 5), color=color.yellow)

// the same on pine
f_cmo(src, length) =>
    float mom = ta.change(src)
    float sm1 = math.sum((mom >= 0) ? mom : 0.0, length)
    float sm2 = math.sum((mom >= 0) ? 0.0 : -mom, length)
    100 * (sm1 - sm2) / (sm1 + sm2)

plot(f_cmo(close, 5))

Trading Applications

Measure momentum strength on a -100 to +100 scale

Identify overbought/oversold extremes

Detect momentum divergences

Use as a filter for trend-following strategies

Related Functions

Frequently Asked Questions

ta.cmo() returns the Chande Momentum Oscillator: a bounded oscillator based on the ratio of summed gains minus summed losses to total movement over length bars.

Both relate to up vs down movement, but CMO uses summed changes over the window in its numerator/denominator form, while RSI uses smoothed averages of gains/losses (Wilder-style in Pine). They can behave similarly but are not identical.

Traders often watch extremes near +50/-50 or +75/-75 depending on settings. Calibrate levels on your instrument rather than using fixed thresholds blindly.

Generate ta.cmo() Code with AI

Skip the manual coding. Use Pineify's AI Coding Agent to generate Pine Script code using ta.cmo() and other built-in functions instantly.