The following is inspired by Robert Pardo's book on optimization (
http://www.amazon.com/Evaluation-Optimization-Trading-Strategies-Wiley/dp/0470128011) where he presents some thoughts about parameter step selection. He argues that you don't want to make the step too small (optimization would take a lot of time, especially if your strategy has several parameters), nor you want to make it too large (loss of optimization accuracy). That, and the fact that I had to wait for 2 hours until five-parameter strategy optimization is completed on my desktop, got me thinking...
Let's say we have a moving average period as one of the optimization parameters with a range of 10 to 100. Let's select 5 as the optimization step. That give us the following set of parameter values
CODE:
Please log in to see this code.
...total of 19 values
The problem is that while the absolute value of 5 represents a 50% increment at the parameter value of 10, it represents only a 5% increment at 100. So while we're obviously jumping over some possibly interesting parameter values at the beginning of the list, we end up churning through a lot of unnecessary small steps toward the end of it.
The fix to this problem is to make the parameter to slide over the logarithmic scale instead of the linear one. Instead of the fixed absolute step value we choose a uniform percent increment value.
First we need to estimate how many steps we need to cover the range
CODE:
Please log in to see this code.
For our example of the 10..100 range and the increment of 20% at each step it gives us 13 steps (12.6293 rounded up).
Next we create a simple parameter for our strategy with the range of 1..13 and step 1.
To find the value at each step we use this method ("val" being the step number 1 to 13):
CODE:
Please log in to see this code.
The resulting parameter value set looks like the following (values are rounded):
CODE:
Please log in to see this code.
In this set the absolute step value increases as we move from the beginning of the list to the end of it. This gives us (a) less parameter values to iterate over (12 vs 19) and (b) a uniform 20% step value increment so we're not losing accuracy at the beginning, nor making a lot of unnecessary iterations toward the end of the range.
Ideally something like this could've been added to the standard CreateParameter method in WealthScript. Because of the protection level of that method I was not able to find a way to create a library function suitable for Community.Components to wrap that method into, so I've ended up just implementing two helper methods above. Maybe Eugene or Cone can make an assessment if this is suitable/can be massaged into some form of a Community.Component method.