Code a strategy that goes long on the highest high 5 bars back, and short on the lowest low 5 bars back. Use stop orders.
Code an entry that goes long when the market goes below or is equal to the lowest close 5 bars back.
Then code an exit that sells the position if the market crosses over or is equal to the highest high 5 bars back.
Use limit orders for both.