Optimizer

The optimizing of trading systems is one of the software's most important functions, right after developing the system logic and its programming. With an Optimizer, you can do the following:
  • Evaluate the performance of a newly developed trading system
  • Select the settings that give the best performance for a trading system
  • Test trading systems for stability and profitability
  • Generate statistical results for different parameter settings
  • Configure trading systems for the usage in the Portfolio
In Tradesignal, the Optimizer is also able to optimize "in-sample" and "out-of-sample" ranges with the start and end bars defined by you. This way you can see how the trading system acts over a defined time span and if the parameter settings could also be applied successfully to other time spans.

Start the Optimizer

To start the Optimizer Wizard you can
  • Click on the Optimize button in the Strategies area in the Toolbar or
  • Select the menu entry Optimize... in the context menu of a symbol or symbol list in the Symbol Lists toolbox.

Call up the Optimizer and choose a Method


Optimizer
The Optimizer in Tradesignal offers you several optimization methods from which you have to select the best one depending for your goals. Also note that some methods take longer to calculate the results than others.
  • Brute Force - Depending on the parameters to be optimized and the set boundary values, the Optimizer runs through all possible combinations of parameters. This method is especially useful if you want to use the results for further analysis, e.g. in Excel. The disadvantage is the possibly high number of combinations, which may lead to a long calculation time.
  • Genetic - Depending on the parameters to be optimized and the set boundary values, the Optimizer runs through the possible combinations of parameters with genetic algorithms that strive to find the best results. The advantage of the method is its lesser calculation time. The disadvantage is that the table of results does not include all possible combination of parameters.
  • Walk Forward - Depending on the parameters to be optimized and the set boundary values, this method outputs complete results over defined ranges. You can define the length of the ranges. Tradesignal lists the results as "in-sample" and "out-of-sample" values. This way, you get an overview of the trading system works for smaller time samples and how stable the results are. The advantages and disadvantages are the same as for "Brute Force".
  • Walk Forward Genetic - This method combines the defined ranges with the genetic algorithm. The advantages and disadvantages are the same as for "Genetic".

Set up Parameter


Optimizing Parameters
After choosing the method, you have to select the parameters you want to optimize.
  • In the list on the left, you can find all optimizable parameters that are available from Money Management, and the input parameters of the included trading systems. (Note: Parameters of indicators are also available for optimization in Tradesignal, which is useful if your trading system is based on the output of an indicator.)
  • In the list on the right, the parameters to be optimized are to be found.
To move a parameter from the right to the left and vice versa, either select it and click on the respective double-arrow button, or double-click the parameter.

You can also select more than one parameter at the same time by holding down the Shift key (selecting several consecutive parameters) or the Ctrl key (selecting several parameters) while clicking on the parameters. To move all parameters at once from one side to the other, select Add All or Remove All.

For the selected parameters, you can enter further values, e.g. for start, end and steps. For that, select the parameter in the list on the right. The fields for the adjustable values show up at the bottom of the dialog.

(Genetic Optimizer) Statistic and Finishing Condition

For the genetic optimizer, you have to select which statistic should measure the success of the optimization.
  • Select whether the highest or lowest value should be used.
  • Select the parameter that should be used as the key parameter for the evaluation (by default Total Net Profit).
  • Select the instrument from which the statistic should be taken. To have a list of options here, independent graphs and strategies have to be available in the current document.
In the next step, you have to set the stop point for the genetic optimization:
  • After no better result was found (in minutes) - This can result in a long optimization duration, since you only set the time limit after finding the optimal value.
  • After a fixed period of time (in minutes) - This allows for a very quick optimization, but might give suboptimal results.

Define the Data Range

Define how much of the historic data should be used for the optimization:
  • Use all available data - This corresponds to the History Length in the chart properties.
  • Use data within the following range of bars - Set a range of data to be used. The maximum range is also given by the History Length in the chart properties.
  • Use data between the following dates - Set a Start and End date for the optimization. To change the dates, either click on the calendar to select a date, or click in the area of day/month/year to change each of the values.

(Walk Forward) Define the Samples


In- und Out-of-Sample
For the Walk Forward methods, you can define the in-samples and out-of-samples bars per sample. The method works as follows:
  1. If you set in-sample to "100" and out-of-sample to "50", the optimizer will use the first 100 bars after the start point for the optimization, and then calculate the values for the next 50 bars with the results from the first 100.
  2. After this, the starting point is moved forward by the range of the out-of-sample length (50 bars), and the above described optimization calculation will be executed again.
This will be repeated as long as enough data is available to fill the in- and out-of-sample ranges.

If you choose the option Anchor in-sample: Start always at the beginning of specified data range, the start point is not moved. Instead, the in-sample starts always at the beginning of the data range, so the in-sample increases in size over time.

Start the Optimizer

Start the optimization by clicking on the Optimize button in the wizard.

Optimizer Buttons in the Toolbar


Optimizer group in the toolbar
In the toolbar, the Table group offers the following functions:

Start/Pause - Click on Pause to get an intermediate result of the optimization. You can start the optimizer again by clicking on Start.

Stop - End the optimization.

View in Chart - Apply the values selected in the table. Use the context menu on the optimizer grid to open a new chart.

Columns - Via this button menu you can find the following options:
  • Column Grouping - Toggles between enable and disable column grouping.
  • Add/Remove Column - Here you can define which columns should be displayed (on the right) and which not (on the left). The indicators correspond to the ones in the Performance Report.
  • Set Graph Axes as Default - Choose this option to use the current chart settings as default in future charts.

Property inspector settings

Runs - Here you can find a list of all runs of the optimizer with date and time. Select an entry from the list to call up the data of that run. Note that the list only displays multiple runs of a specific optimization (called up with Start). When you create another optimization, the counter starts anew for this optimization and another graph and table with results will be displayed.

Advanced Optimizer Settings

Via the Advanced button you can open a dialog with more options.

Advanced General Optimizer Options
  • Number of optimizer threads - Enter a number higher than one, if several optimization routes should be calculated at the same time. You should change the value only if you have a computer with a multi-processors and should ideally not be higher than the amount of CPUs.
  • Thread Priority - Select high, normal or low. This regulates how much system resources the Optimizer is allowed to use.
  • Use a longer history length when optimizing - Allows you entering a history length independent of the chart properties.
  • Auto-start Excel after optimization - If you select this option, the calculation results will be opened automatically in Excel after the optimization.
Advanced Genetic Optimizer Options
  • Only keep better results - Only the best results are kept and displayed.
  • Show all Results - This will keep and display all results. This may lead to a very long table.

Possible Optimizations

Optimizing a single security

You can optimize a trading system for a single chart or symbol.
  • If you have an active chart with a strategy, the Optimize button in the symbol bar is available. Click on it to start the Optimizer wizard.
  • Alternatively, you can choose the entry Optimize in the context menu of a symbol.

Optimizing a symbol list

You have several choices for starting the Optimizer for a list of symbols.

Full symbol lists

The easiest method is optimizing a complete symbol list. To do this, choose the entry Optimize in the context menu of a symbol list.

List in the Scanner or Watchlist

The second way is optimizing from within a Scanner or Watchlist. When you have a list of symbols in the Scanner/Watchlist, click on the Optimize button in the Toolbar.

Several symbols in a chart

The third way is optimizing a chart that includes on or more symbols. To do this, click on the Optimize button in the Toolbar while the chart is active.

Portfolio

Another possibility is the optimization of a Portfolio. To start optimizing a Portfolio, click on the Optimize button in the Toolbar while the Portfolio is active.

The difference between a Portfolio and a Scanner, Watchlist or Chart with several symbols is the combination of strategies and a single account with several symbols in the Portfolio. This way, you can trade several symbols in one Portfolio and generate global trading statistics. Therefore, you receive realistic results for the superposition of trading several symbols at various times in the Optimizer. It allows you to test various trading systems and gives you access to all statistics resulting from all possible parameter combinations.

Analyzing and Interpreting the Optimization Results

Use the Table

On the right side of the optimization window, a table with the optimization results is displayed.
  • You can change the sorting order by clicking on the column header. For example, sort for the longest period of a positive trade.
  • You can also group columns. For this, drag the column header into the very top of the table. This way, you can group any columns to one single group, which can be opened and closed much like the folder tree in Windows Explorer.

Use the Filter

Especially in large tables it is hard to keep the overview. It is also often preferable to ignore certain indicator values. To filter the view, click on the Edit Filter button. A simple example would be filtering for "Total Net Profit > 0".

You can find more information in the chapter Filter.

Apply Results to other Documents

To apply optimized values to the optimized chart/portfolio, double-click the respective table row. You will be asked if you really want to apply the values. Note that you cannot apply single cell contents, only the full row.

To use the values in a new chart or portfolio, choose the options you prefer in the button menu View in Chart in the Toolbar.

Export of Optimizer Results

The results of the Optimizer can be exported via the file menu. Choose the menu entry Export "Optimizer" from the file menu. A request appears. Choose whether you want to export all runs or only the latest. The file dialog opens in which you can specify the directory, file name and file type for the export file before saving it.

Graphic Analysis


3D Diagram
The interpretation of statistic data is often easier when the data is visualized in a diagram. Tradesignal offers a visualization function. As soon as the Optimizer has finished (or is paused), you can find diagrams on the left of the table. Three axes are available; values can be set via the drop-down lists. There are two kinds of diagrams:

3D (Surface) Diagram

This is the standard setting. Choose parameters of the trading system for both the x- and y- axes, and then select a key figure like "Total Net Profit" for the z-axis.

The colored surface shows the development of the key figure in relation to the parameter combination. The different colors mark different values of the key figure (green = positive, yellow = neutral, red = negative). Therefore, the diagram can be read as an elevation profile. When you click on a colored square, the corresponding row in the optimization results table is focused. In addition, you can find a diagram with the key figure and the x-axis parameter below the 3D profile.

2D Diagram


2D Diagram
The simpler variant is the 2D profile. For this, select a key figure for the y-axis and one of the parameters for the x-axis. Set the z-axis to "none". This way, you can have a look at the effect of a single parameter in the trading system. The height of the columns shows the maximum values. The black lines in the columns mark the trading systems results.

The values of the tables and the diagrams are connected.
  • If you click on a value in the table, cross-hairs mark the corresponding position in the diagram.
  • If you click on a position in the surface or the column diagram, the corresponding value in the table is focused.
In addition, you can see the numeric values of the position beneath the mouse cursor to the right of the diagram headlines.

Example: Optimizing the strategy Bollinger Band Breakout for Apple Computer, Inc. (AAPL NAS)


Optimizing a strategy
  1. Click on the Symbol Lists button in the toolbox.
  2. Open the USA/S&P 100 [100]. (If this symbol list is not available, download this list via New Symbol List in the Related Task area.)
  3. Search for the Apple Computer, In.c (AAPL NAS) symbol.
  4. Right-click on the symbol and choose Open in Chart from the context menu.
  5. In the Trading System group in the toolbar, click on Add Strategy.
  6. Select Bollinger Band Breakout (in the tab Complete Systems).
  7. On the tab Position Sizing, select Position Sizing - Percent Volatility.
  8. Click on OK.
The selected strategies are applied to the chart with their default settings, next step is to optimize these settings to yield a higher net profit for historic values.
  1. In the toolbar, click on the Optimize button.
  2. Select the method Genetic.
  3. Remove all select parameters from the list except Period and StdDevs (for example by double-clicking the parameters in the right list).
  4. You can select different ranges and step sizes for each parameter, but in this example we use the default settings.
  5. Click to the next windows. For the finishing condition, select the fixed period of time and set it to "1" minute. Start the Optimizer.
The Optimizer calculates the best results for the strategy. After one minute, the Optimizer stops and the table of results is displayed.