How to write an advanced trend following strategy to algotrade Bitcoin