Rate of change
All indicators

LibraryMomentum

Indicator

Rate of change

How much price has changed over the last bars, in percent.

MomentumOwn pane2 inputsROC

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

InputTypeDefaultRange or choices
LengthlengthWhole number10min 1, max 5000
SourcesourcePrice"close"close, open, high, low, hl2, hlc3, ohlc4, hlcc4

What it draws

LineDrawn as
ROCLine

Guide lines at 0.

Used in

No strategy template reads it yet.

OrionQuant