Even if a trading system does not deliver a good performance the first time you backtest it, there are several techniques you can use to improve it.
The strategy you want to refine could be a strategy implemented with your own buy and sell rules or it could be a popular strategy, widely used by other traders and investors, and whose returns seem to be diminishing; maybe because too many traders are using it which will ultimately lead to a degradation of its profitability.
Before listing the different techniques, you must have a clear idea of the metrics you will be using to assess a stock trading strategy. Some traders prefer comparing trading system results using the Sharpe ratio and other may use a custom metric based on the annual return and the percentage of positive trades for example. You can create custom metrics in QuantShare trading software by clicking on "Create a metric" in the simulator manager (Analysis -> Simulator).
Additional Trading Rules
You can improve the performance of your trading system by adding additional buy, sell, short or cover rules.
It is possible to automate this task by building a huge list of trading rules using the rules analyzer tool (Analysis -> Rules Manager) and then backtesting hundreds and even thousands of trading strategies by combining your strategy with a new rule in each optimization.
This technique is explained in details in the following post:
How to choose which technical indicators to use in your trading system
This is my favorite technique for boosting a trading system return. It consists of adding a market indicator (market timing) in the buy rules list to prevent entering new positions when the market sentiment is bearish.
The market indicator could be a market breadth indicator such as the advance decline ratio or it could be any other sentiment indicator (Example: Number of stocks trading above their 20-bar moving average).
The following post explains this technique in detail:
How to turn any ordinary trading strategy into a very profitable one
Trading System Settings
Trading system settings such as the maximum number of positions in the portfolio, margin factor, slippage and minimum shares can be optimized by updating your trading system then selecting "Optimize" tab.
Other settings can be updated by selecting "Settings" tab then "Capital". You can for example update the number of bars/days to keep an order valid, update the volume filter or decide whether to active stops immediately or not.
Example of usage:
Try different number of positions and choose the best performing stock trading strategies.
This is probably the most used technique to refine a trading strategy. It consists of updating the parameters of the indicators used by your trading strategy.
buy = close > sma(30) and rsi(14) > 80;
The above strategy generates a buy signal when the price is trading above the 30-bar moving average and the relative strength index is above the 80 level.
We can optimize some parameters in the above formula by introducing two optimizable variables (one for the SMA and the other one for the RSI level).
Optimize("sma1", 10, 30, 10);
Optimize("rsi1", 70, 90, 10);
buy = close > sma(sma1) and rsi(14) > rsi1;
By optimizing the above formula, the simulator will generate nine combinations.
buy = close > sma(10) and rsi(14) > 70;
buy = close > sma(20) and rsi(14) > 70;
buy = close > sma(30) and rsi(14) > 70;
buy = close > sma(10) and rsi(14) > 80;
Another technique would be to tweak stop rule settings.
Increasing the trailing stop from 10% to 20% could greatly change your strategy performance. The idea is to test different stop rules and different levels for each stop.
For example, you can add a profit stop rule and then try 10 different variations for the profit stop level.
After updating your trading strategy:
- Click on "Profit Stop" to enable it
- Click on the numeric value next to (Percent/Point) to open the formula editor
- Type "a" or any other keyword to fill the optimization grid
- Type a min, max and step values
- Click on "OK" to save stop rule settings
You can also update "Percent" by "Point" to calculate stops based on dollar changes.
The last technique consists of excluding some stocks or a group of stocks from a trading system.
Some traders prefer to exclude small cap stocks because of their high volatility and probability of increase in slippage, other prefer to trade only small caps because they have historically outperformed large caps.
You can exclude stocks by capitalization, industry, sector, exchange, whether it is optionable...
Data Snooping Bias in Your stock trading Strategy
You must be aware that tweaking a strategy could introduce data snooping bias.
Data snooping bias occurs when creating a strategy that fit historical data (Example: By introducing too many parameters or by eliminating stocks that did poorly during a backtest).
To avoid that, I recommend that you perform a basic in-sample/out-of-sample test during backtests. For example, you can perform all your backtests based on a training set (Example: Period of 2000-2008 or stocks listed on NYSE) and then backtest the best performing trading strategies on a test set (Example: Period of 2008-2012 or stocks listed on NASDAQ). Performance on the test set must also be improved.