This is based on the bot found here. It isn't as smart as gunbot due to limitations of pinescript, but I am posting up for anyone using gunbot as it might help with finding good pairs to trade and good settings for those pairs as you can use this to backtest. Also, I am only guessing at some things that his strategy does, based off the instructions and examples he gave in this thread.
Protected script
This script is published closed-source but you may use it freely. You can favorite it to use it on a chart. You cannot view or modify its source code.
Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?