How to store value

 

hi

i have a code tha tell me what is the lowes bar price  (x) at pervios 100 bars and tell me what was the rsi value (y) of this bar

now, i want to know when the price cross under x if the current rsi is smaller or biger then the preivos rsi (y)

the problem that when the price  cross under the "x" its a new low and its replace my x and my y 

i need to find a way to look what was the "y" at the previos bar and then i can check if the current rsi is smaller or bigger then the previos (Y)


and one more question

there is a function like crossover ?

for exemple :

i want to buy at the moment the rsi currect value cross 70  

Reason: