Chande Momentum Oscillator (cmo)

The Chande Momentum Oscillator (CMO) measures the balance between positive and negative changes in a series over recent candles. The result ranges from -100 to +100 and is not expressed in the unit of the source.

A positive value means that positive changes dominate over the horizon set by length, while a negative value means that negative changes dominate. Near +100, nearly all cumulative movement has been positive; near -100, nearly all of it has been negative. A value close to 0 corresponds either to changes that offset one another or to a series that remained unchanged. CMO’s magnitude therefore represents the degree of imbalance, not a distance in the unit of the source.

Block declaration

A strategy can contain multiple [[cmo]] blocks. Each block produces one numeric series: the CMO value.

Examples

Minimal setup

This block computes CMO from the default close source. Since length is omitted, the block uses the default length 20.

[[cmo]]
id = "cmo"

Custom fixed setup

This block uses a custom length value.

[[cmo]]
id     = "cmo"
length = 18

Finding the optimal length

This block explores a range of values for length to identify the best-performing length.

[[cmo]]
id           = "cmo"
length.start = 10
length.stop  = 30

Searching for overbought and oversold zones

This example combines the [[cmo]] block with two [[constant]] blocks to optimize overbought and oversold thresholds. The condition becomes true when CMO moves above the overbought threshold or below the oversold threshold.

[[cmo]]
id = "cmo"

[[constant]]
id    = "overbought"
start = 50
stop  = 70

[[constant]]
id    = "oversold"
start = -70
stop  = -50

[[condition]]
id            = "momentum_extreme"
condition     = "cmo > overbought or cmo < oversold"
next_block_id = "..."

Parameters

ParameterDescription
id
 String
 Required
Unique name for the CMO series.
source
 String
 or Array
 Optional
Input series used for the calculation.
Accepted forms: source = "hl2" or source = ["close", "hl2"].
Each value can be either a standard price source (open, close, high, low, hl2, hlc3, ohlc4, hlcc4, volume) or the id of another indicator.
Default value: "close"
length
 Integer
 Optional
Observation window; must be ≥ 2 when specified.
If length is omitted, the default value is 20.

Usage:
• Fixed: length = value
• Grid search:
 – length.start = min_value
 – length.stop = max_value
 – length.step = value (optional, default 1)
symbol
 String
 or Array
 Optional
Market symbol(s) used when source only consists of standard prices (open, close, high, low, hl2, hlc3, ohlc4, hlcc4, volume).
If source mixes standard prices and indicator ids, symbol is applied only to combinations based on standard prices.
If source contains only indicator ids, symbol is ignored.
If symbol is omitted, the block inherits the symbol defined in [backtest].
For symbol format, arrays, and alignment rules, see Exchanges, Symbols and Timeframes.
timeframe
 String
 or Array
 Optional
Timeframe on which this indicator is computed.
If timeframe is omitted, the computation uses the grid’s main timeframe defined in [backtest].
For accepted formats and timeframe alignment rules, see Exchanges, Symbols and Timeframes.

Available variables

Use the identifiers below directly in your expressions. The CMO block exposes one numeric series and its length, as well as the input source, symbol, and timeframe.

Assume the block is configured as:

[[cmo]]
id = "cmo"

Then:

VariableDescription
cmo or cmo[0]
Decimal
Current CMO value.
cmo[n]
Decimal
CMO value from n candles ago.
cmo.length
Decimal
Length in use.
cmo.source
String
Input series name.
cmo.symbol
String
Symbol used.
cmo.timeframe
String
Timeframe used.

Notes

  • Numeric variables support arithmetic, comparisons, and logical operators.
  • Text variables are strings intended for equality/inequality checks only.