---
url: /indicators/roc-wb.md
description: >-
  Rate of Change with Bands, created by Vitali Apirine, is a volatility banded
  variant of the basic Rate of Change (ROC) indicator.
package: FacioQuo.Stock.Indicators
docs_version: v3
canonical: https://dotnet.stockindicators.dev/indicators/roc-wb
generated: 2026-10-15T06:15:05.027Z
commit: 4044e66ee11c1611f024b18d0096806706a00c9d
---

# Rate of Change with Bands

Rate of Change (ROC) with Bands, created by Vitali Apirine, is a volatility banded variant of [Rate of Change (ROC)](/indicators/roc.md).
[\[Discuss\] 💬](https://github.com/facioquo/stock-indicators-dotnet/discussions/242 "Community discussion about this indicator")

```csharp
// C# usage syntax
IReadOnlyList<RocWbResult> results =
  bars.ToRocWb(lookbackPeriods, emaPeriods, stdDevPeriods);
```

## Parameters

| param | description |
| ----- | ----------- |
| `lookbackPeriods`*`int`* | Number of periods (`N`) to go back.  Must be greater than 0.  Typical values range from 10-20.  Default is 20. |
| `emaPeriods`*`int`* | Number of periods for the ROC EMA line.  Must be greater than 0.  Default is 5. |
| `stdDevPeriods`*`int`* | Number of periods the standard deviation for upper/lower band lines.  Must be greater than 0 and not more than `lookbackPeriods`.  Default is 5. |

### 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](/guide/getting-started.md#historical-bars) for more information.

## Response

```csharp
IReadOnlyList<RocWbResult>
```

### `RocWbResult`

| property | description |
| ----- | ----------- |
| `Timestamp`*`DateTime`* | Date from evaluated `TBar` |
| `Roc`*`double?`* | Rate of Change over `N` lookback periods (%, not decimal) |
| `RocEma`*`double?`* | Exponential moving average (EMA) of `Roc` |
| `UpperBand`*`double?`* | Upper band of ROC (overbought indicator) |
| `LowerBand`*`double?`* | Lower band of ROC (oversold indicator) |

### Utilities

See [Utilities and helpers](/utilities.md) for more information.

## Streaming

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

```csharp
RocWbList rocWbList = new(lookbackPeriods, emaPeriods, stdDevPeriods);

// call from your WebSocket or SSE message handler
void OnBarReceived(IBar bar) => rocWbList.Add(bar);

// based on `ICollection<RocWbResult>`; fills as the handler runs
IReadOnlyList<RocWbResult> results = rocWbList;
```

Subscribe to a `BarHub` for advanced streaming scenarios:

```csharp
BarHub barHub = new();
RocWbHub observer = barHub.ToRocWbHub(lookbackPeriods, emaPeriods, stdDevPeriods);

// call from your WebSocket or SSE message handler
void OnBarReceived(IBar bar) => barHub.Add(bar);

// results fill as the handler runs
IReadOnlyList<RocWbResult> results = observer.Results;
```

See [Buffer lists](/guide/styles/buffer.md) and [Stream hubs](/guide/styles/stream.md) for full usage guides.

## Chaining

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

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

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

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

See [Chaining indicators](/guide/chaining.md) for more.
