Skip to content
Algo Trade Analytics Docs

ta.cmo() - Pine Script Function

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.

ta.cmo(series, length) → series float
NameTypeDescription
seriesseries int/floatSeries of values to process.

Chande Momentum Oscillator.

  • na values in the source series are ignored.
//@version=6
indicator("ta.cmo")
plot(ta.cmo(close, 5), color=color.yellow)// the same on pinef_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))