All free tools

Momentum indicator

Rate of Change (ROC) Calculator

Compute the Rate of Change as a percentage from the current price and the price N periods ago. The calculation is simple, so the useful part is understanding what the number describes.

ROC (%)
10.00
Positive: the price is higher than it was N bars ago.
Price change
10.00
Current price minus the earlier price.

What the Rate of Change is

The Rate of Change (ROC) is a momentum oscillator that measures the percentage change between the current price and the price a fixed number of periods ago. It is also known as the price momentum percentage.

The formula is ROC = 100 × (price − price N periods ago) / price N periods ago. A reading of zero means the price is unchanged over the window, a positive value means it is higher, and a negative value means it is lower. Because it is expressed as a percentage, ROC values can be compared across instruments with very different price levels. If the earlier price is zero the result is undefined.

Why the ROC is used

ROC is commonly plotted below price as a line oscillating around a zero line. Analysts study zero line crossings, the slope of the line, and divergences between ROC and price as ways to describe how quickly price is changing.

The lookback length is a choice, and shorter lengths react faster but produce more noise. How you read the indicator is entirely your own decision.

What are TradingView and Pine Script?

TradingView is one of the most widely used charting and market-analysis platforms, where traders and analysts study price movement across stocks, crypto, forex, and futures on interactive charts. Pine Script is TradingView's own lightweight programming language, created so anyone can build custom tools that run directly on those charts.

People use Pine Script to build four main kinds of tools. Indicators calculate and plot values on the chart, exactly like the calculation above, but recomputed automatically on every bar. Strategies add explicit entry and exit rules and can be backtested against historical data in TradingView's Strategy Tester to see how they would have behaved. Screeners scan many symbols at once for conditions you define. Alerts notify you the moment a condition you specified occurs, so you do not have to watch the screen.

The value is precision and automation. Instead of eyeballing a chart, you describe exactly what you want measured, visualized, or notified about, and TradingView runs it consistently across any market and timeframe. That is why traders, analysts, and developers write Pine Script: it turns a manual charting idea into a repeatable tool. These tools are for tracking, visualizing, and testing market ideas; they do not tell you what to trade, and that decision always remains yours.

Writing that code by hand means learning Pine Script's syntax, its type system, and the exact names of hundreds of built-in functions. It is a real programming language, and small mistakes stop a script from compiling in the Pine Editor.

Turn this into Pine Script

This calculator gives you ROC at one moment. On a chart it recalculates every bar. In Pine Script that is a single call, ta.roc(close, 9), but alerts, filters, and strategy logic built around it still need to be written.

Pine Script v6
//@version=6
indicator("Rate of Change (ROC)", overlay=false)

length = input.int(9, "ROC Length", minval=1)
rocValue = ta.roc(close, length)

plot(rocValue, "ROC", color=color.blue)
hline(0, "Zero line", color=color.gray)

PineScripter is an AI built specifically for Pine Script. You describe what you want in plain English and it writes TradingView-ready v6 code. Because it is specialized on the Pine Script language and its exact function signatures, it tends to produce code that compiles far more reliably than general-purpose models like ChatGPT, which often invent functions that do not exist in Pine Script.

Related free calculators

From the blog

PineScripter is an AI developer tool that helps you write Pine Script code. It is not a financial advisor and will never offer financial, investment, or trading advice. Everything on this page, including the calculator and the explanations, is provided purely for educational and informational purposes. Any decision about how to interpret an indicator or trade a market is entirely your own. See our full disclaimer for more.