#twitter-follow { border: 0;position: fixed; top: 240px; left:0;} #live-support { border: 0;position: fixed; top: 370px; left:0;} #knowledge-base { border: 0;position: fixed; top: 170px; left:0;}

### Optimization in the statistical data analysis tool

Updated on 2009-07-16

In the last post, Statistical data analysis of time series, we have introduced the rule analyzer and explained how it works and what you can accomplish with.

In this post, we are going to discuss the optimization feature of this tool.
You know now how to create a trading rule and how to analyze it for a specific output.
The ability to create custom output is what makes this tool great. But there is another important feature, which is the optimizer, whose role is to let you quickly discover rules that match your output expectation.
Whether you are looking for securities return, future volatility, a likelihood of an event to occur, optimizing trading rules is something you will find interesting and useful.

To explain how it works, we will use an example. Let us take a simple one; a security making a new high.
The formula for this pattern is: close >= hhv(close, 30)
In the above example we are looking for securities that are making a 30 bar new high.

Here is when the optimizer comes into play, imagine you want to test not the 30 bar new high, but other values (10, 20, 40...)
This is easily accomplished in the rules manager, you just need to change 30 to a variable, let us say 'a'.
Our trading formula will be: close >= hhv(close, a); in the grid below the formula editor, you have to define the maximum, the minimum and the step value.

Setting 10 as minimum, 100 as maximum and 10 as step will let us create 10 variations of the original formula. Click now on 'Analyze the list' and set your symbols list, start and end dates, output... and then start the analyzing process.
After the optimization process is complete you will get detailed results about how the 10 rules variations performed for the specified outputs; you will be presented with a grid that contains the pre-defined metrics as well as your custom metrics if any.
It would be interesting to see how the average output changes for every value of the variable 'a'. It certainly interests a lot of trader.
Here is how to display this graph:
Right click on any formula to open a menu, click on the variable 'a' to display the graph.

Below the chart there are two combo-boxes, the first one let you choose which output formula to use. In this example I have only added one output formula, but you can have as many outputs as you want.

The second one let you choose a metric, this could be a pre-defined metric or you own metric.
I will let you decide how to use and analyze this data.
Note that you can create a formula with 2 or more variables and you will still be able to display how the output varies depending on the value of each of these variables.

In the menu that appears when you have right clicked on a rule. You may have noticed two others elements.
Search: Let you check trading formulas that contain specific keywords. The checked rules could be used to create a new list of rules.
Graph per output: Shows a graph that displays metric values for every output formula.

Combined with the rule analyzer and the custom metrics, I hope you can see how powerful this statistical data analysis tool is. But because we are never satisfied and always seeking for new features that would benefit our users, we will continue improving this tool as well as other QuantShare tools and plug-ins.