How to write an advanced trend following strategy to algotrade Bitcoin

in hive-116221 •  5 years ago 

Trend following is often the easiest in a matter of both getting started with algo-trading and being profitable. In the previous article, I wrote a trend following strategy and even boosted its performance by using a bigger timeframe for determining the trend. But it was a simple enter-at-once and exit-at-once strategy.

The point of this tutorial is to get you started with a few of Jesse’s features that help you write most of the trend following strategies you’ll find. Few of such features are:

Exiting the trade in two points, one being at a fixed price, another at a dynamic price.
Updating the stop-loss to break-even after exiting half the position.
Filtering trades that have a bad win-to-loss ratio.
Using events to hook into life cycles of a trade.

First I create a new strategy with the make-strategy command:

jesse make-strategy TrendFollowingStrategy

And I edit my routes.py file to use this strategy, and I set the timeframe to 4h:

For full deployement checkout source of this article:-
https://towardsdatascience.com/how-to-write-an-advanced-trend-following-strategy-to-algotrade-bitcoin-a38e47443ddc

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!