Click here to Login




How to create and backtest thousands of trading rules in less than 10 minutes

Updated on 2009-08-11





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.











no comments (Log in)

QuantShare Blog
QuantShare
Search Posts




QuantShare
Recent Posts

Create Graphs using the Grid Tool
Posted 1481 days ago

Profile Graphs
Posted 1586 days ago

QuantShare
Previous Posts

Limit and Market orders
Posted 5617 days ago

Ranking system calculation methods
Posted 5626 days ago

RSS feeds transformation
Posted 5630 days ago

Stocks: Market Capitalization
Posted 5632 days ago

Ranking System Engine
Posted 5634 days ago

How to deal with StockTwits data
Posted 5644 days ago

Trend following systems
Posted 5647 days ago


More Posts

Back







QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.