RSI swing trade entry algo

How can I check for RSI swing rejection?

This condition group could take any number of days to be satisfied, but for simplicity lets say we will only check as far back as candle -30 for condition 1.

Swing Trade entry condition group:

  1. *RSI falls to 30 or less (candle X)
  2. *RSI crosses back above 30 (candle Y)
  3. *RSI decreases without crossing back into 30 or less. (candle Z)
  4. RSI then breaks its most recent high (candle 0)
  • Can occur at any number of previous candles before condition 4 is met.