Functions
talib.roc()
Calculates the percentage of change (rate of change) between the current value of source and its value length bars ago. It is calculated by the formula: 100 * change(src, length) / src[length].
Syntax
talib.roc(series float source, series int length) → series float
Arguments
source required series float Series of values to process. length required series int Number of bars (length). Return Type
series float Example
indicator("Rate of Change (ROC)", overlay=false)
length = input(10, "ROC Length")
rocValue = talib.roc(close, length)
plot(rocValue, color=color.blue, title="ROC")
hline(0, "Zero Line", color=color.gray)