Skip to content

Chande Momentum Oscillator (CMO) ​

Created by Tushar Chande, the Chande Momentum Oscillator is a weighted percent of higher prices over a lookback window. [Discuss] 💬

csharp
// C# usage syntax
IReadOnlyList<CmoResult> results =
  bars.ToCmo(lookbackPeriods);

Parameters ​

paramtypedescription
lookbackPeriodsintNumber of periods (N) in the lookback window. Must be greater than 0.

Historical price bars requirements ​

You must have at least N+1 periods of bars to cover the warmup periods.

bars is a collection of generic TBar historical price bars. It should have a consistent frequency (day, hour, minute, etc). See the Guide for more information.

Response ​

csharp
IReadOnlyList<CmoResult>
  • This method returns a time series of all available indicator values for the bars provided.
  • It always returns the same number of elements as there are in the historical price bars.
  • It does not return a single incremental indicator value.
  • The first N periods will have null values for CMO since there's not enough data to calculate.

CmoResult ​

propertytypedescription
TimestampDateTimeDate from evaluated TBar
CmodoubleChande Momentum Oscillator

Utilities ​

See Utilities and helpers for more information.

Chaining ​

This indicator may be generated from any chain-enabled indicator or method.

csharp
// example
var results = bars
    .Use(CandlePart.HL2)
    .ToCmo(..);

Results can be further processed on Cmo with additional chain-enabled indicators.

csharp
// example
var results = bars
    .ToCmo(..)
    .ToEma(..);

See Chaining indicators for more.

Streaming ​

Use the buffer-style List<T> when you need incremental calculations without a hub:

csharp
CmoList cmoList = new(lookbackPeriods);

foreach (IBar bar in bars)  // simulating stream
{
  cmoList.Add(bar);
}

// based on `ICollection<CmoResult>`
IReadOnlyList<CmoResult> results = cmoList;

Subscribe to a BarHub for advanced streaming scenarios:

csharp
BarHub barHub = new();
CmoHub observer = barHub.ToCmoHub(lookbackPeriods);

foreach (IBar bar in bars)  // simulating stream
{
  barHub.Add(bar);
}

IReadOnlyList<CmoResult> results = observer.Results;

See the guide for more information.

See Buffer lists and Stream hubs for full usage guides.