Turn any indicator into a 1/-1 value

 

Hi, I have an indicator that I want to turn into a new custom indicator: 

this new custom indicator should have a value of +1 when the value of the indicator in the current bar is higher than the value of the indicator in the previous bar, and -1 vice versa.

Is there a short way to do this? Maybe post an example on how to do this with RSI?

The new indicator should work with iCustom to reference to the old indicator,

and then some kind of loop like this: (where i is the current period? and iCustombuffer the buffer from the old indicator

          if (iCustombuffer(i) >= iCustombuffer(i-1))

            line(i)=1;

          if (iCustombuffer(i) < iCustombuffer(i-1))

            line(i)=1;

      }

pls some help

Reason: