Log in to see Cloud of Tags

Wealth-Lab Wiki

Exhaustive To Local Maxima Optimizer

RSS
Created by Kurt J. Meister, this optimizer is his holiday gift to the Wealth-Lab community. Think of this as an exhaustive optimizer with an auto shut off.

Advantages

The number one reason to use this optimizer is to attempt to shorten the time it takes to optimize a strategy, while finding the optimal results within the range of parameters set. Unlike the Monte Carlo or Particle Swarm optimizers, this is an exhaustive optimizer, so it will give you the exact parameters which result in the highest local optima. (See Limitations below.) In my albeit limited testing, this optimizer, with the default Number of Steps after Highest Value = 5, reaches the same result as the Exhaustive optimizer in about half the number of runs.

How it Works

It begins with each parameter at its Start value (or Default value, if the parameter is unchecked) and sets an initial stop value for each checked parameter equal to the Start value plus the Number of Steps after Highest Value selected (but not beyond the Stop value). It then begins performing an exhaustive optimization. After each run, it looks at the selected Metric to Maximize (Net Profit, for example) to determine whether it is new high value. If it is a new high value, it resets the stops equal to the parameters which resulted in the new highest value plus the Number of Steps after Highest Value (again, not exceeding the Stop value). If no new high value is found after each of the parameters reaches its stop value, it ends the optimization.

Example

Let’s say you have a cross-over SMA strategy and want to optimize the number of days for the short and long SMA’s for the highest Net Profit using the default Number of Steps after Highest Value = 5. Your Strategy Parameters might look like this:

ParameterDefaultStartStopStep
Short SMA30209010
Long SMA909020010

The first run will, by definition, result in a new highest Net Profit, so the optimizer will set the stops at Short SMA = 70 (20 + 5 * 10) and Long SMA = 140 (90 + 5 * 10). Let’s say no parameters result in a higher Net Profit until Short SMA = 50 and Long SMA = 60. The optimizer will then reset the stops at Short SMA = 90 (it won’t go beyond the Stop value) and Long SMA = 110. If no combination of parameters results in a higher Net Profit, the optimizer will finish at Short SMA = 90, Long SMA = 110 (instead of 200), saving a substantial number of runs. When the optimization is completed, you can click on the Optimizer Performance tab to show exactly how many runs and approximately how much time you saved.

How to Use It

For me, setting optimization values has always been somewhat arbitrary. If I set the Stop value too low, one of the optimal parameters may be at the Stop value, and I have to set a new Stop value and run a new optimization. On the other end of the spectrum, if I set the Stop value too high, the optimization may run for a long time only to find that the optimal parameters were at or near the Start value.

This optimizer makes the Stop values relatively unimportant, since it will stop the Number of Steps after Highest Value after reaching the optimal values, regardless of how high the Stop values are set. The only caveat is that you have to make sure you have enough data to allow the highest Stop value to be meaningful. For example, if you are optimizing an SMA on 1 year of daily data, a Stop value higher than 220 becomes meaningless.

The Number of Steps after Highest Value parameter is essentially asking how far from a local optima are you willing to look for a higher local optimal. Therefore, it is a tradeoff. As shown in the example, using too low a value may result in finding a local optima, but not the global optima. Using too high of a value, may result in many additional and unnecessary runs, and using way too high a value, just makes this an Exhaustive optimizer.

Image

Limitations

Like all optimizers, other than Exhaustive, there is no assurance that this optimizer will result in the global maximum. Going back to the example, Net Profits might again begin increasing at Short SMA = 30 and Long SMA = 160 and reach the highest value at Short SMA = 30 and Long SMA = 260. This optimizer (using the default Number of Steps after Highest Value = 5) would never find that global maximum. Bear in mind, however, that even the Exhaustive optimizer would not have found it, if the Long SMA Stop were set to 200.

Feedback

Please share your experience good and bad with this optimizer on the Wealth-Lab Forum.

Thank You’s

A big thank you goes out to Eugene and LenMoz for tirelessly helping me learn the basics of programming and the intricacies of writing optimizers that work in Wealth-Lab Pro. Without their help, I would never have been able to make this something suitable for everyone.

Important Disclaimer: The information provided by Wealth-Lab is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.  The owner of Wealth-Lab.com assumes no liability resulting from the use of the material contained herein for investment purposes. By using this web site, you agree to the terms of this disclaimer and our Terms of Use.


ScrewTurn Wiki. Some of the icons created by FamFamFam.