How it is calculated
ROC is (price divided by the price length bars ago, minus 1) times 100, on the chosen source, with no smoothing. It is 0 when the earlier price is 0. As TA-Lib ROC.
Reference: TA-Lib ROC
How to read it
Above zero price is higher than at the start of the window, below zero lower. The further from zero, the faster the move; a ROC that sinks toward zero while price still rises shows the move slowing. Each value rests on a single old bar, so one unusual bar at the start of the window moves it. Being in percent, it compares markets at different price levels.
In a strategy
A momentum filter that allows longs only while price rose over the window: ctx.ind("roc", length=10) > 0, with an exit when it falls back below zero.
Inputs
| Input | Type | Default | Range or choices |
|---|---|---|---|
Lengthlength | Whole number | 10 | min 1, max 5000 |
Sourcesource | Price | "close" | close, open, high, low, hl2, hlc3, ohlc4, hlcc4 |
What it draws
| Line | Drawn as |
|---|---|
| ROC | Line |
Guide lines at 0.
Used in
No strategy template reads it yet.