Returns the rank correlation index: how closely the price ranking in the window follows time order, from -100 to 100.
ta.rci ranks the values in the window from lowest to highest, with ties sharing the average of their ranks, and correlates that ranking with the order of the bars. The result is scaled to percent.
+100 means every bar was higher than the one before it; -100 means every bar was lower. Output starts once length bars are available, and an na in the window gives na.
Syntax
ta.rci(source: series int/float, length: simple int) -> series floatArguments
| Name | Type | Default | Description |
|---|---|---|---|
| source | series int/ | required | The series whose rank order is compared with time order over the last length bars. |
| length | simple int | required | Number of bars ranked. A whole number of 2 or more. |
Returns
series float: a value from -100 to 100, or na while the window is not full.
Remarks
- Rank-based, so a single extreme value moves it no more than any other bar.
Example
//@version=6
indicator("RCI")
plot(ta.rci(close, 9), "RCI", color = color.teal)
hline(80)
hline(-80)See also
Runs on Sidechair