First update.
1/ Adding some differents settings for the "range finder". From conservative, to agressive, to ultra-agressive. You need to check the input setting and play with the numbers to define the range. Default is 0.1. On high tf, make the numbers bigger, like 0.8 to 5. Up to what you love.
2/ Adding some filters to avoid some noise.
Strategy is very simple. Coding was a bit harder: 220 lines of code.
Results look really good to me.
Enjoy.