roc

Rate of Change

roc(source, periods)

Parameters

Name Type Description
source field Data series
periods int Lookback period

Formula

```
ROC = ((value - value[periods]) / value[periods]) * 100
```

Examples

// positive 12-period momentum
roc(close, 12) > 0;

// strong 25-period uptrend (>10% gain)
roc(close, 25) > 10;

// volume surge (>50% increase from 20 bars ago)
roc(volume, 20) > 50;

// momentum turning positive
crossover(roc(close, 12), 0);

Returns

Percentage (positive = upward, negative = downward)