Would-be trend followers are frequently stopped by the inability to backtest strategies. Yes, you can use Excel (sort of) but it's exceedingly slow, cumbersome, and will likely require some VBA coding. It simply isn't the right tool for the job.
So where do you turn?
The fastest way to test your trend following system is with our Strategy Builder. Below, we'll walk you through each of the design steps and get you up and running in just a few minutes!
Building your Trend Following Strategy from Scratch
This is a quick tutorial, so we're just going to get you on the path to trend following bliss and let you figure out what you want to test and trade. Once you get started, we're sure you'll come up with heaps of great ideas!
Instruments and Risk Management
Start by going to the Strategy Builder here. If you haven't made an account yet, take a moment to sign in so you can save your strategy. From there, you can name your trading bot, set your account size, choose your stocks or ETFs, and set some risk management parameters.
Here's an example below.
The Position Sizing selection tells the algorithm how much you're willing to put into each trade when you initially open it. In this case, we just stuck with Equal Allocation which will divide your capital equally into each instrument you choose. We have 4 ETFs in the image above (SPY, XLE, QQQ, GLD) with a $5,000 account, so each ETF would get $1,250. Other options include Volatility or ATR Allocation which will use a risk-adjusted measure to size your position. Feel free to give those other options a shot!
The Position Management section determines how your position will be changed over time. Some traders like to add to positions if certain thresholds are hit (i.e. pyramiding), others will adjust as risk changes, and others will do nothing. Let's follow the "do nothing" principle by selecting "No Risk Management" which turns this feature off.
When you're finished with your selections above, go to the When to Buy tab to set your entry signals.
We'll use a simple breakout signal - which will buy when a high in the closing price is hit over a fixed time interval.
The signal above is set to buy if the price closes at a 100-day high. You could also set it to look for intraday highs or lows as well. And there's nothing magic about 100 days either - we're just trying to be reasonably long term to pick up on strong trends.
To set your exit conditions, click the When to Sell tab, and add the 100-day breakout, but set it to look for a low instead of a high at close. We'll also add a trailing stop loss for extra protection (likely overkill, but we'll let you run the tests to see what's better).
The trailing stop loss is sized at 2ATR, meaning we take the average true range over the past 40 days (in this case) and subtract that from the price. We'll move the stop loss up as the price moves up and keep it fixed at the highest value we reach. If the price drops below that level at close, then we exit the position.
Now our strategy is all set and we're ready to run our backtest!
Backtesting your Trend Following System
With all of that set, click on the orange, "Run Backtest" bar and in just a moment, you'll have tested your strategy using our custom, event-driven backtest engine!
Let's take a look at the results.
The equity curve shows the results of our system versus an equally-weighted buy and hold strategy. Each of the blue dots shows either a buy or sell, and you can either hover over them to see the details or go to the Trade Data tab to read more. You can see that the system ended a little below the buy and hold model in terms of total returns, but with much less volatility.
Detailed statistics are given under the Bot Metrics tab on the right side of the screen:
Here we can see that our trend following bot would have given us a 54% return with a 0.65 Sharpe. You can look at drawdowns, volatility, win rate, and so forth to better gauge the performance of your bot and determine if this is a strategy you want to take forward.
Certainly, we could have done better than this by adding some additional instruments to be more diversified, or sizing our position according to risk, or updating our breakout signals. There are a limitless number of possibilities here for you to play with!
Let's put those improvements to the side for now and assume you're happy with these results. What then?
If you're a subscriber, you can save your bot, and go to the Bot Garage which contains all of your available systems.
Inside your Bot Garage, you can activate your bot to get alerts when your strategy is placing trades.
This gives you the opportunity to take this strategy live into your own account and see how it performs!
Test and Trade Your Trend Following System
Trends will always exist in markets. It's part of human nature to chase bubbles and performance. Trend following allows you a way to systematically take advantage of those impulses by jumping on those trends and - doing what most bubble chasers don't - controlling your risk so you can get out when things reverse.
It doesn't need to be sophisticated to be effective.
Don't be held back by a lack of software or coding capability to customize your trend following system. Check out our offering where we strive to build the premier trend following system builder today!