This looks very interesting indeed. With this kind of ranging market detection in place the bot could be left running even in flat periods like the last few days without worrying about losing money. Given that the source is included, I wonder how hard this would be to incorporate into the bot? I've not done any coding for a while but might have to look into this if I ever get the time.
Have a look at the one version I posted above with added volitality check. You should be able to just change the function "updateVol" to do a completely different calculation and therefore use a different indicator. The work of adding new thresholds and checking for them is all included.