One of the best ways to understand rules-based investing strategies is to take a look at how they are built.
There is usually a deliberate sequence of steps that take place when building a trading system. Each step builds on the previous step, resulting in a robust process.
The process begins with observation, after which a hypothesis is developed. Next, filters and signals are developed. Finally, the system is backtested and adjustments are made. This step has to be done carefully to ensure the system is not curve fitted to suit the data. Live testing also ensures that the system actually performs as expected.
This brief introduction runs through the process of creating a trading system.
Developing a rules-based trading system
Creating your trading system
This is a general overview on developing trading strategies. For an overview of strategy development using the Logical Invest Quant Trader platform, you may wish to watch this webinar or refer to our forum. Quant trader is a standalone system that comes with all the data, prebuilt strategies and optimization algorithms. Another popular software package is Amibroker, although this platform requires investors to learn the scripting language, source data and build strategies from scratch.
Creating a trading system starts with observation. You may notice certain patterns or relationships in the market. You may also read about recurring patterns in a white paper or in academic research. Your trading system will start out as a hypothesis based on the patterns you discover.
Before you can test your idea, you will need to make sure you have the necessary data. This post shows you how to source market data for free. Depending on the software you use you may be able to source historical data for free or pay for a subscription. In addition, you should make sure the data is adjusted for dividends and stock splits.
You can add filters before or after you create signals, depending on the type of strategy. If your system invests in stocks you may wish to filter out stocks with a market capitalization below $1 Billion or $500 million or exclude stocks with low turnover. Filters can include any metric that you can access as time series data. Hence you can use price and volume data, or fundamental data. You can also filter out stocks from a specific sector, or ETFs with a certain expense ratio.
A signal is a trigger to buy or sell an instrument. Usually, you will base your signals on price action, moving averages and other indicators, or volatility. It can also be based on an indicator based on another instrument, and index or the ratio of two instrument prices.
Your trading system will also need an exit strategy. You can base exits on profits, losses or rotation. If you base an exit on rotation, you will exit an instrument when its rank falls below a certain level. You will then enter another trade with a new instrument. You can base profit and loss based exits on indicators or on percentage gains or losses.
Testing your trading system
Backtesting is essential to determine how well the system performs. When you backtest, you will be looking at the annual return, the volatility, the Sharpe ratio (which normalizes return vs volatility) and the size of the drawdowns. For a long-term investment type system, you may also want to compare the results to a benchmark index.
Next, you might adjust some of the parameters used to generate signals to improve the system. The reality is that many systems just won’t perform the way you would like, and you’ll often have to start again from scratch.
It’s important to avoid overfitting. Overfitting happens when a strategy is over optimized to perform well on a specific set of data but will be unlikely to perform as well in the future. You can avoid this by using walk-forward testing. To do this, you will break the times series data into subsets. Hence, you will optimise the trading system for the first data set and then test it on the second dataset.
Finally, if the results from backtesting are promising, you will test the system on live data to make sure the performance is similar to the backtest results. If the results are significantly different, you will need to go back to backtesting, and possibly source more data to ensure the system is robust.
Developing a trading system begins with observation and an idea. Next comes developing a combination of filters, signals and exit strategies. And finally, you must do thorough backtesting to prove the system. This is a process of trial and error which may take many attempts before you arrive at a system with accepatble results. You will encounter many dead ends, but can eventually create a profitable system.