It took a little bit longer (as usual) but I made both a long and a short version based on the original idea to trade the rebound of S1 and S2 (respectively R1 and R2).
I kept the moving average filter Grahal introduced and added an adx-filter (we want the market to be trending so it reverts to its mean), a trailing stop loss and a dynamic take profit. For the short version it gave the best result to only trade the bounce from R1 for the long version only bounce from S2 (the later reduced the number of trades of course significantly; i left the S1 condition in the code so you can uncomment it if you want to).
Funnily the short version became better than the long version (isn’t it always different from what one expects?).
Since this is a rather fast strategy running on 5min chart i recommend to reoptimize the important parameters every month with a loopback of 12-13 month.
The backtests shown below i ran with spread of 0,6.