Optimize

Optimizing your Strategy

An optimized strategy is not much different from a regular strategy. Essentially, it has ranges of values for some parameters, while a normal strategy only has a single possible value for each parameter.

For example, if a parameter is configured to take 3 different values, and another to take 5 different values, then an optimized strategy will be run 15 times, once for each possible pair of values.

This allows users to:

  • find the best possible values for their parameters, and
  • evaluate the robustness of their investment strategy when the context changes.

The sub-strategies of an optimized strategy will be run in parallel on our grid of servers, in a fraction of the time it would have taken on your own computer.

Submit a strategy as optimized

To run an optimized strategy, you just need to flag one or more variables with @Optimized and give them minimum, maximum, and step values.

In the example below, the trigger variable will take values 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09 and 0.10 in ten separate runs of this strategy.

Eclipse with optimization

Settings

To configure a strategy with optimization parameters, just change the values in the @Optimized block. For instance, this block:

@Optimized(start=1,stop=6,step=2)

will try all possibilities from 1 to 6 by 2 increments, that is [1,3,5]. 6 will not be used, as it is lower than 5 + 2.

Optimization parameters do not have to be integers. For instance:

@Optimized(start=1,stop=2,step=0.1)

will try all values between 1 and 2 by 0.1 increments (there will be a total of 11 values, including the last value 2.0).

Results

The results in the list of backtests will contain additional information, including the various values taken by each variable.

Optimization-results.png

Samples

Several sample strategies available on the web site and on the Market Runner local runner use optimization parameters. Give them a try.

For all possible ways of using optimized parameters, see sample DemoOptimizedParameters.

Going further

Feeling limited with the @Optimized options? Checkout the advanced optimizations here.