What is the Chande Momentum Oscillator (CMO)?
The Chande Momentum Oscillator (CMO), developed by Tushar Chande, is a technical momentum indicator that measures the difference between the sum of recent gains and the sum of recent losses, divided by the sum of all price changes over a specific period. Unlike other oscillators like RSI or Stochastic which limit their range, CMO ranges from -100 to +100. This broad range allows it to directly quantify pure momentum without being skewed by fixed scaling, providing a clearer picture of trend strength and potential turning points.
In Pine Script, CMO is a valuable tool for traders seeking to identify the underlying directional bias and conviction of price movements, as well as classic overbought/oversold and divergence signals.
Components and Calculation
The calculation of CMO involves tracking positive and negative price changes:
- Calculate Upward and Downward Momentum:
- `SM_Up = Sum of (Current Close - Previous Close)` for positive changes over `length` periods. (If `Current Close < Previous Close`, the change is 0 for `SM_Up`).
- `SM_Down = Sum of (Previous Close - Current Close)` for positive changes over `length` periods. (If `Current Close > Previous Close`, the change is 0 for `SM_Down`).
- CMO Formula:
`CMO = ((SM_Up - SM_Down) / (SM_Up + SM_Down)) * 100`
The result is multiplied by 100 to scale it between -100 and +100.
A CMO value near +100 indicates strong upward momentum, while a value near -100 indicates strong downward momentum. Values near 0 suggest low momentum or a flat trend.
Basic Chande Momentum Oscillator Implementation in Pine Script
Pine Script v5 provides a convenient built-in function `ta.cmo()` for straightforward implementation.
//@version=5
indicator("My Chande Momentum Oscillator", overlay=false) // overlay=false to plot in a separate pane
// Input for CMO length
length = input.int(9, title="CMO Length", minval=1)
// Calculate CMO value using the built-in function
cmoValue = ta.cmo(close, length)
// Plot the CMO line
plot(cmoValue, title="CMO", color=color.new(color.blue, 0), linewidth=2)
// Plot horizontal lines for overbought and oversold levels
h_overbought = hline(50, "Overbought (+50)", color=color.new(color.red, 0), linestyle=hline.style_dashed)
h_oversold = hline(-50, "Oversold (-50)", color=color.new(color.green, 0), linestyle=hline.style_dashed)
hline(0, "Zero Line", color.gray, linestyle=hline.style_dotted)
// Fill background between CMO and levels for visual clarity
fill(h_overbought, h_oversold, color=color.new(color.gray, 90))
Practical Chande Momentum Oscillator Trading Strategies
1. Overbought and Oversold Conditions
When CMO moves significantly above +50, the asset is considered overbought, indicating strong bullish momentum that might be nearing exhaustion. Conversely, a move significantly below -50 is oversold, suggesting strong bearish momentum that might be nearing exhaustion.
- Buy Signal: CMO moves below -50 (oversold) and then crosses back above -50.
- Sell Signal: CMO moves above +50 (overbought) and then crosses back below +50.
//@version=5
strategy("CMO Overbought/Oversold Strategy", overlay=true)
// Inputs for CMO
length = input.int(9, title="CMO Length", minval=1)
overboughtLevel = input.int(50, title="Overbought Level")
oversoldLevel = input.int(-50, title="Oversold Level")
// Calculate CMO
cmoValue = ta.cmo(close, length)
// Define conditions for entries and exits
// Buy when CMO moves below oversold and then crosses back above it
longCondition = ta.crossunder(cmoValue, oversoldLevel) // CMO goes oversold
longExitCondition = ta.crossover(cmoValue, oversoldLevel) // CMO exits oversold (potential buy)
// Sell when CMO moves above overbought and then crosses back below it
shortCondition = ta.crossover(cmoValue, overboughtLevel) // CMO goes overbought
shortExitCondition = ta.crossunder(cmoValue, overboughtLevel) // CMO exits overbought (potential sell)
// Strategy entries/exits (entry upon exiting extreme zones)
if (longExitCondition)
strategy.entry("Long", strategy.long)
if (shortExitCondition)
strategy.entry("Short", strategy.short)
// Optional: Plot CMO in a separate pane for visualization
// plot(cmoValue, "CMO", color.blue)
// hline(overboughtLevel, "Overbought", color.red)
// hline(oversoldLevel, "Oversold", color.green)
// hline(0, "Zero Line", color.gray)
2. CMO Zero Line Crossover (Trend Direction)
The zero line in CMO serves as a crucial indicator of momentum bias. A crossover suggests a shift in the short-term trend.
- Bullish Momentum: CMO crosses above the zero line. This indicates that bullish momentum is dominating bearish momentum.
- Bearish Momentum: CMO crosses below the zero line. This indicates that bearish momentum is dominating bullish momentum.
//@version=5
strategy("CMO Zero Line Crossover Strategy", overlay=true)
// Inputs for CMO
length = input.int(9, title="CMO Length", minval=1)
zeroLine = 0
// Calculate CMO
cmoValue = ta.cmo(close, length)
// Define conditions for entries
longSignal = ta.crossover(cmoValue, zeroLine)
shortSignal = ta.crossunder(cmoValue, zeroLine)
// Strategy entries/exits
if (longSignal)
strategy.entry("Long", strategy.long)
if (shortSignal)
strategy.entry("Short", strategy.short)
// Optional: Plot CMO in a separate pane
// plot(cmoValue, "CMO", color.blue)
// hline(zeroLine, "Zero Line", color.gray)
3. CMO Divergence Strategy
Divergence between price and CMO can signal potential trend reversals. This occurs when price makes a new high/low, but CMO fails to confirm it, indicating weakening momentum.
- Bullish Divergence: Price makes a lower low, but CMO makes a higher low. This indicates weakening bearish momentum and a potential upward reversal.
- Bearish Divergence: Price makes a higher high, but CMO makes a lower high. This indicates weakening bullish momentum and a potential downward reversal.
//@version=5
indicator("CMO Divergence Scanner", overlay=true)
// Inputs for CMO
length = input.int(9, title="CMO Length", minval=1)
overboughtLevel = input.int(50, title="Overbought Level")
oversoldLevel = input.int(-50, title="Oversold Level")
centerLine = input.int(0, title="Zero Line")
// Calculate CMO
cmoValue = ta.cmo(close, length)
// Plot CMO in a separate pane
plot(cmoValue, "CMO", color.blue)
hline(overboughtLevel, "Overbought (+50)", color.red)
hline(oversoldLevel, "Oversold (-50)", color.green)
hline(centerLine, "Zero Line", color.gray)
// Simple divergence detection (conceptual, robust detection requires advanced pivot logic)
// This is a simplified example focusing on price vs CMO divergence.
// Bullish Divergence (Price lower low, CMO higher low)
bullishDivergence = close[2] > close[1] and close[1] > close and cmoValue[2] < cmoValue[1] and cmoValue[1] < cmoValue
// Bearish Divergence (Price higher high, CMO lower high)
bearishDivergence = close[2] < close[1] and close[1] < close and cmoValue[2] > cmoValue[1] and cmoValue[1] > cmoValue
plotshape(bullishDivergence, title="Bullish Divergence", location=location.belowbar, color=color.new(color.green, 0), style=shape.triangleup, size=size.small)
plotshape(bearishDivergence, title="Bearish Divergence", location=location.abovebar, color=color.new(color.red, 0), style=shape.triangledown, size=size.small)
alertcondition(bullishDivergence, "Bullish CMO Divergence", "Potential bullish reversal based on CMO divergence.")
alertcondition(bearishDivergence, "Bearish CMO Divergence", "Potential bearish reversal based on CMO divergence.")
Optimizing CMO Performance
To get the most from the Chande Momentum Oscillator in Pine Script:
- Parameter Tuning: The `length` parameter (default 9 or 20) significantly influences CMO's sensitivity. Shorter lengths make it more responsive but potentially noisier, while longer lengths provide smoother signals but with more lag. Experiment to find optimal settings for your specific asset and timeframe.
- Adjust Extreme Levels: For highly volatile assets or strong trends, you might consider adjusting the overbought/oversold levels (e.g., +60/-60 or +70/-70) to filter for only more significant momentum extremes.
- Combine with Trend Filters: While CMO can indicate trend strength, it's still an oscillator. Using a longer-term trend filter (like a long-period moving average or Ichimoku Cloud) can help avoid false signals against the primary trend, especially when CMO hovers near the zero line.
- Multi-Timeframe Analysis: Confirm CMO signals on a higher timeframe before acting on signals from a lower timeframe for added reliability.
- Confluence with Price Action: Always look for CMO signals to be confirmed by price action, such as candlestick patterns, breaks of support/resistance, or chart patterns.
Common CMO Pitfalls
- False Signals in Ranging Markets: Like most oscillators, CMO can generate numerous false overbought/oversold signals when the market is consolidating sideways.
- Lag: Despite being a momentum indicator, CMO still has some inherent lag due to its averaging components.
- Divergence Can Be Early: Divergence is powerful but can signal a potential reversal too early, and the trend might continue for some time after the divergence appears.
- Not a Standalone Indicator: CMO should always be used as part of a broader trading system, combined with other indicators (e.g., volume, volatility indicators) and price action analysis for confirmation.
Conclusion
The Chande Momentum Oscillator (CMO) is a unique and highly effective momentum indicator in Pine Script for TradingView. Its distinct calculation provides a clear measure of directional conviction and trend strength, making it valuable for identifying overbought/oversold conditions, shifts across the zero line, and potential reversals through divergence. By understanding its calculation, thoughtfully tuning its parameters, and integrating it strategically within your comprehensive trading approach, you can leverage the CMO to gain deeper insights into market dynamics and enhance your trading decisions.