In the first post of our series we have discussed the main building blocks of strategy development. Now it is time for us to use what we have learned and conceptualise the base strategy for our multi-coin trading bot! Step by step, we walk you through the decision-making process leading us to a strategy that we can backtest and compare against a benchmark.

Try for yourself for free

Investment Universe

As we know, the first important component is the universe that our bot trades in. The choice of investment universe has a high impact on bot performance. For example in momentum strategies, where past performance is compared across assets to form investment decisions, considerations like correlation, cointegration and other factors need to be considered (the interested reader is referred to this post). Loosely speaking, we can argue that when selecting assets only based on their comparative past performance (as in momentum strategies), it is favourable to have an investment universe with "heterogeneous" reactions to different market movements.

In the case of crypto assets, we are dealing with a market that is highly correlated (for more on this, check this post) - especially when trading crypto-fiat pairs (currency pairs that trade crypto currency against fiat currency, such as the US Dollar). However, since our goal is to build a trend-following bot, where entry and exit signals depend on the technical indicators of each coin individually, dependence is a smaller challenge for our strategy. We focus on pairs with a high market cap that provide us with a deep and liquid market. A good place to check the market capitalisation of cryptocurrencies is www.coinmarketcap.com.

Top 10 Cryptocurrencies by Market Cap (as of 2020-07-04)

Listed above are the top 10 cryptocurrencies by market capitalisation as of time of this writing. For the initial implementation of our bot we select 5 coins to form our basis universe. We pick the largest 5 cryptocurrencies by market cap excluding the Bitcoin Forks (Bitcoin Cash and Bitcoin SV) and Cardano (due to its recent run-up increasing its market cap almost 5-fold). This leaves us with Bitcoin (BTC), Ethereum (ETH), Ripple (XRP), Litecoin (LTC) and EOS  as the five largest cryptocurrencies by market cap. These coins form the base universe for our strategy. Additionally, they form the benchmark that we compare our strategy against.

Strategy Setup

Since we use the Trality Rule Builder throughout this series, selecting the universe is super easy! Simply search for the desired coins in the dropdown list and add them to your universe. You should end up with the following:

Universe selection in the Trality Rule Builder

Now that we have our base universe, we need to select the time frame (or the frequency) on which our bot will trade. As a base strategy we use 1hr candles just like in our BTC trend-following strategy. We need our time frame to be long enough to form significant trends that our system can exploit, but also short enough to be able to adjust quickly to trend reversals that can happen much faster in crypto assets than in traditional asset classes.

Next up is the indicator selection and its parameterisation. Our choice of building a trend-following bot already points us into the direction of certain indicators. Among the most common trend-following indicators are Moving Average Crossovers, Moving Average Convergence/Divergence (MACD), Relative Strength Indicator (RSI) and On-Balance Volume (OBV). You can check the Trality documentation on these indicators here.

We use the same indicator as in our crisis-protection post, an Exponential Moving Average Crossover. This provides us with a trend-following indicator that places more weight on more recent price movements and, in theory, should provide more accurate and faster signals. Its potential disadvantage versus a Simple Moving Average is the possibility of false signals and whipsaws in our performance. However, since we focus on 1hr candles and take the aforementioned quick trend reversals in cryptocurrencies into account, an EMA crossover is a good starting point.

For the parameterisation of our crossover, we use the same lookback periods of 20 and 40 hours as in our BTC strategy referred to earlier. We are going to take a closer and more systematic look at the selection of both the indicator as well as the parameterisation in the next post, this implementation is intended to get us off the ground running.

The set up of the signal generator is very straightforward in Trality's Rule Builder. Under the Strategy tab, simply select "Add New" and choose "MA-Crossover" as the predefined strategy. Switch on the expert mode and configure the buy signal:

Buy signal using the Trality Rule Builder

After setting up the sell signal in similar fashion, we are set in terms of signal generators!

Full set of signal generators

For position sizing we assume a long-only strategy and we allocate 20% of our capital to each of the 5 coins so that we are always between 0% (if the signal for all of the coins is negative) and 100% (if all signals are positive) invested. We close out our position in one coin as soon as a sell signal is received. We set this up under the Parameters tab.

Setting the position size

Backtest

The last decision that we must make before we can run our first backtest of this strategy is selecting the in- and out-of-sample periods. As the main premise of our strategy is that it protects us during turbulent market times, we want to have our out-of-sample period starting in February 2020, shortly before Covid-19 caused a massive sell-off in the financial markets. Since a good rule of thumb split for in-sample and out-of-sample data is using 2/3s of the data set for strategy optimisation and the remaining data for out-of-sample validation, we start our backtest at the beginning of April 2019. This gives us a total dataset of roughly 15 months (or roughly 11000 hourly candles). We use the data between 2019-04-01 and 2020-01-31 (10 months) as our in-sample dataset and the data between 2020-02-01 and 2020-06-30 (5 months) as the out-of-sample dataset.

We have finally reached the point where we can test our strategy using the Trality backtesting module!

Backtest result

Not bad for a first test run! Over the backtesting period our strategy returned 44.99% after fees, outperforming the benchmark of buy-and-hold of our universe by 13.73%!

This concludes the second part of our series on strategy development, as we have completed our first multi-coin trading strategy setup and backtest. In the next post, we will start to look at some of our strategy assumptions in more detail and show a more systematic and quantitative approach to select some of the parameters. Stay tuned!

Try this out for yourself?

Stefan is a quant with more than 6 years experience in the finance industry. He currently holds the role of Director Risk Management & Analytics at an independent investment manager specialising in insurance investments for institutional clients. In his free time he has been developing and implementing algorithmic trading strategies across multiple asset classes for 7 years.