# 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] ðŸ’¬

```
// 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>
```

- This method returns a time series of all available indicator values for the
`quotes`

provided. - 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
`N`

periods will have`null`

values for ROC since thereâ€™s not enough data to calculate.

### 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(..);
```