Sidechair

ta.cmo()

Browse the reference

Returns the Chande momentum oscillator: the sum of up moves minus the sum of down moves, as a percentage of their total.

Try it in the editor

ta.cmo sums the positive bar-to-bar changes of the series and, separately, the size of the negative ones over length bars. It returns 100 * (up - down) / (up + down).

The result runs from -100 (every move was down) to +100 (every move was up). It appears on bar number length + 1.

Syntax

Pine Script
ta.cmo(series: series int/float, length: series int) -> series float

Arguments

NameTypeDefaultDescription
seriesseries int/floatrequiredSeries whose changes are summed.
lengthseries intrequiredNumber of bars in the sums. A whole number of 1 or more.

Returns

series float: a value from -100 to 100, or na while the window is not full.

Remarks

  • Unlike ta.rsi, the sums are not smoothed recursively, so the output depends only on the last length bars.

Example

Pine ScriptChande momentumOpen in editor
//@version=6
indicator("CMO")
value = ta.cmo(close, 9)
plot(value, "CMO", color = value >= 0 ? color.green : color.red)
hline(50)
hline(-50)

See also

Runs on Sidechair