Chande Momentum Oscillator (Unsmoothed) (CMOU)
Summary
Chande Momentum Oscillator: Tushar Chande's original momentum oscillator, computed from plain moving-window sums of the up-moves and down-moves over the period.
Bounded in [-100,+100]; positive = net upward momentum, negative = net downward.
CMOU is the version as defined by Chande in his book The New Technical Trader (1994), and is the more common implementation used by TradingView (ta.cmo) and pandas-ta's default.
See CMO for a smoothed variant of CMOU.
Chart
Chart metadata i
Outputs
outReal:line·zero·positive·negative
Formula
d = P[t]-P[t-1]; over the trailing optInTimePeriod changes accumulate Su = sum of the positive d, Sd = sum of -d for negative d. CMOU = 100 * (Su-Sd)/(Su+Sd); 0 when Su+Sd == 0 (an exactly flat window). Unlike CMO, the sums are the plain period totals (a moving-window sum), not Wilder-smoothed averages, so there is no unstable period.
Inputs
inReal— Source price/value series
Outputs
outReal— CMOU oscillator value
Parameters
| Parameter | Type | Default | Accepted values | Description |
|---|---|---|---|---|
optInTimePeriod | integer | 14 | 2–100000 | Number of trailing price changes summed |
Properties
Numerical Stability: Start-Independent
| ☐ Overlap Input |
| ✅ Independent Y-Axis i |
| ☐ Candlestick |
| ☐ Display Shift |
| ☐ Can Output NaN or ±Inf |
| ☐ Identity at Period 1 |
| ☐ Uses Transcendental |
| ☐ Input Must Be Positive |
Example
#include <stdio.h>
#include <ta_libc.h>
int n = 252;
double series[252]; /* your data, oldest first */
double out[252];
int outBegIdx, outNBElement;
TA_Initialize();
TA_CMOU( 0, n - 1, series, 14, &outBegIdx, &outNBElement, out );
printf( "%d values from bar %d: [%.4f, ..., %.4f]\n", outNBElement, outBegIdx, out[0], out[outNBElement - 1] );use ta_lib::Core;
let series = vec![0.0; 252]; // your data, oldest first
let mut out = vec![0.0; 252];
let core = Core::new();
let range = core.cmou(0, series.len() - 1, &series, 14, &mut out)?;
println!("{} values from bar {}: [{:.4}, ..., {:.4}]", range.count, range.beg_idx, out[0], out[range.count - 1]);import io.github.talib.Core;
import io.github.talib.OutRange;
import java.util.Locale;
double[] series = new double[252]; // your data, oldest first
double[] out = new double[252];
Core core = Core.DEFAULT;
OutRange r = core.cmou(0, series.length - 1, series, 14, out);
System.out.printf(Locale.ROOT, "%d values from bar %d: [%.4f, ..., %.4f]%n", r.count(), r.begIdx(), out[0], out[r.count() - 1]);using System;
using TALib;
var series = new double[252]; // your data, oldest first
var outReal = new double[252];
var core = Core.Default;
OutRange r = core.Cmou(0, series.Length - 1, series, 14, outReal);
Console.WriteLine(FormattableString.Invariant($"{r.Count} values from bar {r.BegIdx}: [{outReal[0]:F4}, ..., {outReal[r.Count - 1]:F4}]"));import { cmou } from 'ta-lib';
const series = new Float64Array(252); // your data, oldest first
const { begIdx, values } = cmou(series, { timePeriod: 14 });
console.log(values.length + ' values from bar ' + begIdx + ': [' + values[0].toFixed(4) + ', ..., ' + values[values.length - 1].toFixed(4) + ']');import (
"fmt"
"log"
talib "ta-lib.github.io/go"
)
series := make([]float64, 252) // your data, oldest first
out := make([]float64, 252)
core := talib.NewCore()
r, err := core.CMOU(0, len(series)-1, series, 14, out)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])Implementation
Added in 0.8.1 (ta-lib-python 0.8.1).
TA-Lib Definition: cmou.c · cmou.yaml
| Native | File |
|---|---|
| C | ta_CMOU.c |
| Rust | cmou.rs |
| Java | Core_CMOU.java |
| C# | Core_CMOU.cs |
| TypeScript | cmou.ts |
| Go | cmou.go |
Python: talib.CMOU (ta-lib-python 0.8.1 or later), see ta-lib-python.
TA-Lib is also available for R and more using a wrapper.
Aliases
Chande Momentum Oscillator (Unsmoothed)
See Also
References
- Tushar S. Chande, The New Technical Trader, John Wiley & Sons (ISBN 0471597805)