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

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.