It is not illegal. But your thougts on trading bots are not clear about the loss/profit thing. Usually, bots trade for you but they are written script and they can not perform anything else other than the script. In a sudden economic event, trading bots will just kill your portfolio because in big event, price get dip significantly which may be lead you big lose.