Rate of Change (ROC)
Calculate the Rate of Change (ROC) for a given price series.
The Rate of Change is a pure momentum oscillator that measures the percentage change in price between the current period and the price a fixed number of periods ago. It oscillates around zero: positive values indicate price is higher than window periods ago (upward momentum), while negative values indicate price is lower (downward momentum).
The formula is as follows:
\[\text{ROC} = (\operatorname{Close}(t) / \operatorname{Close}(t - \text{window}) - 1) \cdot 100\]Also known as: ROC, Price Rate of Change, momentum.
No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Rate of Change (ROC) for you. Just ask in plain English.
Calculate the Rate of Change (ROC) in Python
The Rate of Change (ROC) is available in the Technicals module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_rate_of_change as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(tickers=["AAPL", "MSFT"])
toolkit.technicals.get_rate_of_change()
Parameters
get_rate_of_change accepts the following parameters:
- period (str, optional): The time period to consider for historical data. Can be “daily”, “weekly”, “quarterly”, or “yearly”. Defaults to “daily”.
- close_column (str, optional): The column name for closing prices in the historical data. Defaults to “Adj Close”.
- window (int, optional): Number of periods to look back for the rate of change calculation. Defaults to 12.
- rounding (int | None, optional): The number of decimals to round the results to. Defaults to 4.
- growth (bool, optional): Whether to calculate the growth of the Rate of Change. Defaults to False.
- lag (int | list[int], optional): The lag to use for the growth calculation.
- standardize (bool, optional): Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False. Defaults to 1.
Related Momentum Indicators
The Technicals module page introduces the module, and the sidebar lists all of its functions.