Need help with a coding for RSI in pi

Trying to create a strategy in Pi for RSI with two candles.

Buy: Previous candle RSI< 80 and current candle RSI> 80 with current candle close> previous candle close.

Sell: Previous candle RSI> 20 and current candle RSI< 20 with current candle close < previous candle close.

Can anyone help with this strategy?

Why don’t you check out @Streak, it will be much easier to create there.

You easily create this in Streak.

Here are the conditions for Buy

buy signal:
ref(rsi(close,14)>80,0)>ref(rsi(close,14)<80,1)
sell signal:
ref(rsi(close,14)<20,0)<ref(rsi(close,14)>20,1)

Hi @veera_krishna

You can use this condition

Long Entry: RSI(0) higher than 80 and RSI(-1) lower than 80
Short Entry: RSI(0) lower than 20 and RSI(-1) higher than 20