Click here to Login




Optimization of a trading system

Updated on 2010-04-06





Optimization is useful in many different ways. In trading, you can for example use an optimizer with a backtester or simulator engine to vary some parameters of a trading system and see if this can increase the overall portfolio performance, or you can use an optimizer to test multiple variations of a particular buy rule in a trading system.

Almost every piece of a trading system or trading strategy can be optimized; you can optimize buy, sell, short or cover rules, order types, order limits, portfolio settings, stops... The optimization is performed using one of the following algorithms: Exhaustive optimization, Genetic algorithm and Population-based incremental learning or PBIL.

The Exhaustive optimization, which is also called Brute force optimization, tests every possible solution. This technique should be applied only when you have a small number of combinations to test. As an example, a trading strategy with 5 factors to optimize (each factor vary from 1 to 10) creates 100,000 combinations.

In case you have several hundreds or millions of combinations to test; you should consider using the Genetic algorithm and the PBIL algorithm. By using these algorithms in the QuantShare trading software, you can optimize millions of combinations of a trading system, as well as trading rules, ranking systems and neural network models. We will dig deeper into these algorithms in a future post.

For now, let us use the exhaustive optimization to detail the factors or settings that can be optimized in QuantShare.

Create a trading system:
In the menu of your trading software, select "Analysis" then click on "Simulator". In the simulator form, click on "Add" to create a new trading system.

Optimize trading rules:
The main component of a trading system is its rules list. The buy, sell, short and cover rules are used by the simulator to decide which positions to enter and which positions to exit.
These rules can be optimized directly with the formula editor or using the wizard.
For example, under the "Buy at open of tomorrow", click on "Add Rule". Under the "Rule" panel, type "rsi(a)" (Relative Strength Index) in the first input field and "b" in the second input field. When done, two lines appears in the Grid; these lines let you define the minimum, maximum and step values of the variable you are about to optimize.
In the "a" variable line, type "7" under the "Min" column, "14" under the "Max" column and "7" under the "Step" column.
In the "b" variable line, type "40" under the "Min" column, "70" under the "Max" column and "10" under the "Step" column.
Click on "Update" to save changes; the left panel displays "Rule0 (8)", which means that the rule has eight combinations. Click on "Close" to switch back to the trading strategy editor form.



Select "Create trading system using the formula editor" tab to see how the trading system rules are translated into the QuantShare vector-based language.

Optimize trading system' settings:
In the "Create a trading strategy" form, select "Optimize" and then click on "Optimization". Click on "Add item" to create a new optimizable variable; double click on the cell under the "Variable" column to open a list of variables. Select for example "Number of Symbols" (This field defines the maximum number of securities that should be available in your portfolio at any given moment), type "6" under the "Min" column, "10" under the "Max" column, "2" under the "Step" column and click on "OK" to save your inputs.
You now have created three more iterations or combinations. Your total number of combinations is 24 (8 * 3).



In the next post, we will use the money management scripting language to create more combinations.











no comments (Log in)

QuantShare Blog
QuantShare
Search Posts




QuantShare
Recent Posts

Lock, Link and Undock your Charts
Posted 290 days ago

QuantShare
Previous Posts

Optimization of a trading system
Posted 3269 days ago

Short Index - Part 2
Posted 3304 days ago

Short Index - Part 1
Posted 3311 days ago

Historical Market Data
Posted 3332 days ago

Historical volatility estimators
Posted 3345 days ago

Short Selling Stocks
Posted 3353 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 2019 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.