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.