RSI Flag when RSI crosses any value

Im initializing a variable , suppose ‘rs_flag’ as 1 at the start. Now whenever RSI cross 40 from below, want to change the ‘rs_flag’ value to 2, which I will be using it in set conditions. Anybody help me in this?

I think in condition you can check like if rsi> 60, buy position. here in runtime variable you can set variable rs_flag =2. do you want use that flag in next condition then you can use it.