OPEN-SOURCE SCRIPT
Updated ROC with closed based coloring & info table [DB]

Rate of Change (ROC) Basics
The Rate of Change (ROC) is a momentum oscillator measuring the percentage price change between the current close and the close from N periods ago.
Calculated as:
Traders use ROC to:
My improvements:
Visual Clarity
What you can benefit with this over the regular ROC:
Faster Analysis: The visual cues make direction and strength instantly obvious and it allows for faster decision making while preserving more mental capital.
The Rate of Change (ROC) is a momentum oscillator measuring the percentage price change between the current close and the close from N periods ago.
Calculated as:
Pine Script®
ROC = [(Current Close - Close N periods ago) / Close N periods ago] * 100
Traders use ROC to:
- Identify overbought/oversold conditions
- Spot momentum shifts
- Confirm trend strength
My improvements:
Visual Clarity
- Color-Coded Direction: ROC line changes color (green/red/yellow) based on intra-candle momentum shifts.
- Direction Table: Instant view of the last change in ROC with the candle close (▲ UP / ▼ DOWN / ▶ FLAT).
- Cells for current value and previous change between timeframe bar period.
What you can benefit with this over the regular ROC:
Faster Analysis: The visual cues make direction and strength instantly obvious and it allows for faster decision making while preserving more mental capital.
Release Notes
Fixed a typo which made the Flat condition display as "UP" on the info tableRelease Notes
Made each cell optional to displayOpen-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
For quick access on a chart, add this script to your favorites — learn more here.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
For quick access on a chart, add this script to your favorites — learn more here.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.