roc

forge.tafunctionSince Forge API 1
Functionpython
forge.ta.roc(source: ArrayLike,period: int = 12,method: str = 'percent') -> np.ndarray

Change over period bars, as a percent, a fraction or a ratio.

Parameters

NameTypeDefault
sourceArrayLike
periodint12
methodstr'percent'

Indicator: Rate of change

percent is 100 * (price - earlier) / earlier, fraction the same without the 100, ratio is price / earlier and ratio100 is 100 * price / earlier. mt5 is MetaTrader 5's 100 * (price - earlier) / price, which divides by the current price. A zero denominator leaves the bar empty.

Classpython
forge.ta.ROC(**inputs: Any) -> None

Change over a number of bars as a percent, fraction or ratio.

Inputs

NameTypeDefaultRange
sourcesourceclose
periodint121 to 5000
methodchoicepercent

percent: 100 * (x[i] - x[i-period]) / x[i-period]

fraction: (x[i] - x[i-period]) / x[i-period]

ratio: x[i] / x[i-period]

ratio100: 100 * x[i] / x[i-period]

mt5: 100 * (x[i] - x[i-period]) / x[i], the MetaTrader 5 form

A zero denominator leaves the bar empty.