Pivot exit conditions

Hi

Can you help create the following strategy

Entry could be between any pivot levels, but I want to exit on the next Pivot point profit.

For e.g.

when the stock is purchased above pivot it should exit at r1
when the stock is purchased above r1 it should exit at r2
when the stock is purchased above r2 it should exit at r3

thanks