From Trading View, we see that the rsi can be written in pinescript as follows:
pine_rsi(x, y) => u = max(x