Rate of Change (ROC)

Rate of Change, also known as Momentum Oscillator, is the percent change of price over a lookback window. Momentum is the raw price change equivalent. A Rate of Change with Bands variant, created by Vitali Apirine, is also available. [Discuss] 💬

chart for Rate of Change (ROC)

// C# usage syntax
IEnumerable<RocResult> results =
  quotes.GetRoc(lookbackPeriods);

// usage with optional SMA of ROC (shown above)
IEnumerable<RocResult> results =
  quotes.GetRoc(lookbackPeriods, smaPeriods);

Parameters

lookbackPeriods int - Number of periods (N) to go back. Must be greater than 0.

smaPeriods int - Optional. Number of periods in the moving average of ROC. Must be greater than 0, if specified.

Historical quotes requirements

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

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

Response

IEnumerable<RocResult>

RocResult

Date DateTime - Date from evaluated TQuote

Momentum double - Raw change in price over N periods

Roc double - Percent change in price (%, not decimal)

RocSma double - Moving average (SMA) of ROC based on smaPeriods periods, if specified

Utilities

See Utilities and helpers for more information.

Chaining

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

// example
var results = quotes
    .Use(CandlePart.HL2)
    .GetRoc(..);

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

// example
var results = quotes
    .GetRoc(..)
    .GetEma(..);