Home Creators Posts Import Register Favorites Logout

Content

Introduction

In this post I wil show you yet another crypto trading strategy I found on Github, which has entered my strategy league on the 4th spot with a remarkable 290 points. And I will show you later in the video how this strategy works.

Where to find this strategy

But before I show you the inner workings of this strategy I first want to give many thanks to the original author of the code “Paul Csapak”. You can find the code on his github page here: https://github.com/paulcpk/freqtrade-strategies-that-work

And if you like his work, then please give him a warm thank you by visiting his github repo and give it a star.

Initial backtest and optimization results

So after I found his repository with multiple strategies in it, the first thing that crossed my mind is ofcourse if these ideas are worth exploring futher. So the first thing I did is to backtest this Double EMA Crossover with Trend algo and see how it would perform on my specific backtest setup.

And for those who wonder what my setup is, I test 50 pairs on the largest possible date range of data that I could get from the exchange and then backtest over all the timeframes you see In the table. The exact details are on my website and Patreon page for this setup.

Now, right from the start it got some pretty amazing results by itself. It immediately scored 290 points. And if you see in the table, you will see that only the Sharpe ratio stays behind of the Calmar and Sortino. The profit factor is a nice 1.50, which is a calculation of the profits divided by the losses. of the 50 pairs I tested 64 percent acted well on this strategy. But the negative thing here is that the drawdown is 28% and it only has a winrate of 31%. So if you trade this system, then be prepared to take lots of losing trades before hitting your winners and let these run to get the maximum benefit.

In a way, by using this strategy, you have to have a lot of faith and confidence in the algorithm. And when trades are entered you have to be able to sit on you hands so to actually let these winners run instead of taking profits too early. As you can see from the exit signals on this timeframe, there is a huge amount of losses and only one third of the trades actually make most of the profit.

Finally I also want to say that you will have to take these profits with a grain of salt as well, since mostly the altcoins have provided these gains and it is hard to say if these specific pairs will perform as well in the future. So please be aware of this.

Now I also have done a optimization session for this strategy and since there were no buy and sell settings configured, I only could optimize the ROI and Stop Loss settings.

After optimizing

And these optimizations could improve the Sharpe and Sortino ratio better. Also more pairs were able to profit from these settings and the drawdown percentate also improved a lot thanks to tweaking the stoploss and ROI.

And as you can see from the exit reasons, the ROI now takes care of most of the profits. And here certainly something has to be done to the configured exit reasons if you want to use this way of locking in profits. And maybe keeping more of it in the process…

Unfortunately, the winrate stayed the same but if you know the other trend trading strategies by now, this is not really a surprise anymore. Most of them have similar winrates.
However this time profits look to be more realistic now.

Nonetheless I decided to keep the originals results in the strategy league since this is what the author has coded and also want to prevent overfitted results in the league.

The strategy itself

But what about the strategy itself, how does it work?

Let’s dive into the code to find out what the algorithm looks like…

# Minimal ROI designed for the strategy.
# This attribute will be overridden if the config file contains "minimal_roi"
# minimal_roi = {
#     "40": 0.0,
#     "30": 0.01,
#     "20": 0.02,
#     "0": 0.04
# }
# This attribute will be overridden if the config file contains "stoploss"
stoploss = -0.2
# Optimal timeframe for the strategy
timeframe = '1h'
# trailing stoploss
trailing_stop = False
trailing_stop_positive = 0.03
trailing_stop_positive_offset = 0.04

It was originally made with the 1 hour timeframe in mind and stop loss is set to 20% loss. ROI has been commented out so the algo solely depends on the exit signals to stop open positions.

As for the used indicators here.
The strategy only uses the EMA and there are three timeperiods configured here. A 9, 21 and 200 timeperiod.

def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe['ema9'] = ta.EMA(dataframe, timeperiod=9)
dataframe['ema21'] = ta.EMA(dataframe, timeperiod=21)
dataframe['ema200'] = ta.EMA(dataframe, timeperiod=200)

The buy signal happens when the 9 EMA is above the 21 EMA and only when the close of the candle is above the 200 EMA.

dataframe.loc[
(
# fast ema crosses above slow ema
(qtpylib.crossed_above(dataframe['ema9'], dataframe['ema21'])) &
(dataframe['low'] > dataframe['ema200']) &  # Candle low is above EMA
# Ensure this candle had volume (important for backtesting)
(dataframe['volume'] > 0)
),
'buy'] = 1

Selling occurs when the 9 EMA gets below the 21 EMA OR if the low of the candle is below the 200 EMA

dataframe.loc[
(
# fast ema crosses below slow ema
(qtpylib.crossed_below(dataframe['ema9'], dataframe['ema21'])) |
(dataframe['low'] < dataframe['ema200']) # OR price is below trend ema
),
'sell'] = 1

So clearly this is a simple spot EMA crossover strategy where there is a overall distiction between Bull and Bear markets. Also when there are medium term downtrends, the strategy tries to lock in profits only to buy again when these medium trends are turning upwards again.

Where to find these results

So by this time you know how this strategy works and how it performs. I hope you now got enough information to decide if this trading strategy is something to look further into and do further research on before using it in actual trading.

All output of these tests will be in the following post I created earlier: https://www.patreon.com/posts/86798977

In the mean time I am going to test another trading algorithm to see if it performs even better and I’ll let you know the results in the next video or blog post.

Till then,

Goodbye!

Comments

No comments found for this post.