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]
// usage IEnumerable<RocResult> results = quotes.GetRoc(lookbackPeriods); // usage with optional SMA of ROC (shown above) IEnumerable<RocResult> results = quotes.GetRoc(lookbackPeriods, smaPeriods);
int - Number of periods (
N) to go back. Must be greater than 0.
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.
- This method returns a time series of all available indicator values for the
- It always returns the same number of elements as there are in the historical quotes.
- It does not return a single incremental indicator value.
- The first
Nperiods will have
nullvalues for ROC since there’s not enough data to calculate.
DateTime - Date from evaluated
double - Raw change in price over
double - Percent change in price (%, not decimal)
double - Moving average (SMA) of ROC based on
smaPeriods periods, if specified
See Utilities and helpers for more information.
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(..);