ta.rma() - Pine Script Function
ta.rma()
Section titled “ta.rma()”Overview
Section titled “Overview”Moving average used in RSI. It is the exponentially weighted moving average with alpha = 1 / length.
Syntax
Section titled “Syntax”ta.rma(source, length) → series floatParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| source | series int/float | Series of values to process. |
Returns
Section titled “Returns”Exponential moving average of source with alpha = 1 / length.
Remarks
Section titled “Remarks”- na values in the source series are ignored; the function calculates on the length quantity of non-na values.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("ta.rma")plot(ta.rma(close, 15))//the same on pinepine_rma(src, length) => alpha = 1/length sum = 0.0 sum := na(sum[1]) ? ta.sma(src, length) : alpha * src + (1 - alpha) * nz(sum[1])plot(pine_rma(close, 15))