Thanks jcl, it think it really simplified the algo.

BTW, may i know what this code mean?
series(TMASlope(0))+shift

Does it return the series' pointer added with the shift?
So that the data that push in the RSI is a shifted data series?