We all know how difficult it is to find profitable trading rules that give you an edge in the markets. And because it takes a lot of time in research to find such trading rules, we will present you with a method for creating as many trading rules as you want; the backtest requires just one mouse click.
The complete process of finding rules worth integrating into your trading systems can take from hours to decades depending on the time and effort you are willing to spend on the research.
Whether you want to create trading strategies for stocks, ETFs, future, options or currencies (forex), there is a way to produce thousands of trading rules and to completely automate the backtesting process in a matter of minutes; the rest of the article describes how to achieve this.
The first step toward this goal is to create a list of time-series. By time-series I mean security prices (close, open, volume...), indicators (rsi, macd, adx, obv, cci...), external indexes (sp500, nasdaq, us dollar index...), custom composites (stocks making new highs...), fundamental ratios (peg, per, sales, insider data...), neural network models, ranking systems …
Once you define and build a list of time-series which as you will see later takes only few minutes, you will have to create what we call masks. Masks are formulas that contain a variable whose name is 'mask', this variable will be substituted by the time-series formula. Using masks, you can instantly transform a dozen of time-series to hundred of trading rules. And if you include some parameters optimization in your masks, these hundreds of trading rules will generate thousands.
All in all, it should take you less than 10 minutes to perform all these steps and once you start backtesting rules, you should wait maybe some few hours in order for the analyzer to complete. When done, you will be presented with a grid that details all the trading rules performances and statistics for the outputs you selected.
You can also create as many outputs as you want, for example: your first output could be the return of a strategy that holds a security for 30 bars and the second one could be the return of a strategy that uses a 10% trailing stop.
Now let us details how to use QuantShare in order to achieve the different steps described above:
Create time-series: Select 'analysis' from the menu then 'rules manager'. Create a new list of rules, select it, and then click on 'mass rules'.
Click on the 'add from time-series builder' button. Select 'include indicators' then click on 'next'. Now check some indicators then click on 'finish'.
Create masks: Back to the previous 'mass rules' form, create some masks in the right panel rules editor box.
Example of masks: (Once you write a mask formula, click on 'create' to add it)
mask > a, where 'a' varies from 10 to 90 with 10 as step.
mask < a, where 'a' varies from 10 to 90 with 10 as step.
mask > ref(mask, 1)
mask > sma(mask, a), where 'a 'varies from 20 to 100 with 10 as step.
rsi(mask) > a ...
mask > 0.9 * hhv(mask, a) ...
Create as many masks as you want then click on 'create rules'.
Analyze trading rules: Select the list of rules you created at the beginning. Click on 'analyze the list', update the analyzer settings and start the backtesting process.
Now take a break and come back in few hours to analyze the results.
The next step will be to select the most performing rules for the output you selected and create a genetic algorithm or PBIL model to get the best performing combination of these trading rules.