LTP crosses earlier high

I have to enter the trade once

  1. A candle meets base entry criteria. Need to know it’s HIGH.
  2. Next or next-to-next or next-to-next-to-next candle closes above HIGH of the candle in step #1.
  3. Next or next-to-next or next-to-next-to-next candle crosses HIGH of the candle in step #2.

I want to enter the trade when condition in #3 is met (candle needn’t be closed).

Can somebody please guide how to do this?