Building a Trading System Part 2: Our First System
In this article, we’ll be creating a very rough trading system which may or may not be profitable to start with. We’ll be covering:
- Indicator and trigger selection
- Momentum vs mean reversion strategy basics
If you haven’t read the first part in this article series, I recommend doing so before continuing further.
Indicator and trigger selection
As mentioned in the first part of this series, a discretionary trading system can be built from pattern recognition, or from indicators. To make things a little easier for beginners, we’re going to start with indicator-based systems and get to the pattern-based ones further down the line. Our entry and exit criteria will be based on signals from our chosen indicator(s).
When you’re new to trading, or just looking to try something you aren’t familiar with, it can be a pretty daunting task picking an indicator but it doesn’t have to be: pick one at random. Most indicators can be profitable with the correct set of rules to guide them, so don’t be afraid to grab one that sounds cool and play around with it. It probably won’t be ideal, but it doesn’t have to be. It just needs to be consistent.
For our first strategy, we’re going to use an indicator most people are familiar with; the Moving Averaged Convergence-Divergence oscillator, or MACD for short. This is an indicator that measures the relationship between two moving averages on an asset’s chart. It is unbounded, which means it does not have a limit to how high above zero or how low below zero it can go. If you’re unfamiliar, it looks like this:
It is a trend-based lagging indicator, which means that it indicates recent past momentum in the market; the wider the gap between the two lines, the stronger the momentum. It lags because it does not attempt to predict price, only shows the relationship of moving averages which are calculated live.
We’ll be using the default TradingView settings on the indicator to start (fast MA = 12 bars, slow MA = 26 bars and a signal length of 9).
Mean reversion vs momentum
Before we continue, it’s important to clarify the difference between a momentum strategy and a mean-reversion strategy.
A momentum strategy is based on trend-following, expecting to ride momentum in one direction or the other until the momentum slows or reverses.
A mean-reversion strategy on the other hand expects markets to remain relatively stable (although this can apply to a slow, steady trend as well), and looks for abnormal behavior to take positions betting on a return to the average.
Both strategies have their pros and cons, but for the time being we’ll focus on momentum strategies since the cryptocurrency market is usually highly momentum-driven, with brief periods of mean-reversion interspersed.
For this strategy, our basic framework is simple: we will take a long position whenever the MACD lines cross upward (which turns the histogram in the middle green), and short when they turn downward with the histogram red. Our triggers will only apply once the candle has closed, thereby cementing the position of the MACD. Is this profitable? Let’s find out!
Everything sounds pretty simple, the rules we have in place so far are easy to follow. But at the moment, while everything looks good on first glance, we have no idea whether this strategy is going to make or lose money. We need to backtest it.
While backtesting can be automated in TradingView with a bit of pinescript knowledge, I prefer to do it live using the replay tool. This allows me to spot patterns which I may find useful in honing my trade criteria. In essence, this method involves choosing a specific date in the past, applying my indicator to the chart and noting down each result in a spreadsheet (entry, exit, $ change and % change).
Throughout this series, I will be using January 1st, 2018 through June 1st, 2019 as our backtest date range when testing strategies on the 1D and higher timeframes. Tradingview has a limitation on past data on lower timeframes, and so backtest date ranges on those timeframes will be specified individually.
In the next article I’ll cover backtesting in a bit more depth because there is quite a bit to it in order to ensure that your data is reliable, but for now let’s take a look at our results (Google Sheets link here) using this strategy on the 1D timeframe. (When we get more in depth next week, I’ll include a graph.)
A quick look tells us that this strategy does seem to perform well with a total profit of $8,941, assuming a flat 1BTC position size was used on each trade. At 17 wins and 22 losses, this puts the strategy at a 43.6% strike rate with an average 2.71% gain per trade: not bad, considering all we did was slap an indicator on the chart.
So far we have some promising numbers and the strategy seems to work right out of the box but if you remember the last article, there are multiple parts required for a complete trading system and what we have so far only covers our entries and exits.
So how are we going to determine risk?
We’re going to need a lot more data, and that means more backtesting.
Join me next week!
This is the second in a series of articles on building your trading system. If you learned anything or found this article valuable, please leave it some claps (up to 50!), share it on Twitter and other social media and leave a comment! It really helps with visibility. For more like this, follow me here and on twitter!