This is the script I used in BITMEX for auto trading XBTUSD using great Chrome extension called
Auto4mex. Default settings are good for 1h candle nowadays (September October 2018 period for Bitcoin). If more volatility comes adjusting needed. Enjoy !