Parameter Combinations and Optimisation Flashcards
Counting Parameters
If there are n parameters, and each takes at least k values, then there are at least k^n parameter combinations.
Optimisation Criteria / Fitness Function
- maps trading results to fitness.
- higher fitness means better trading strategy results.
Example Fitness Function
Profit or return; normally one would incorporate risk too, e.g., via the Sharpe ratio.
Grid Search
We define allowable parameter values for each parameter individually, and then look at all combinations.
For a grid search, we must specify parameter ranges for each parameter individually.
We focus on regularly-spaced sequences as returned by the seq function, therefore we need to decide on:
- Endpoints
- Increments
We should also evaluate all parameter combinations.
This is a 2d grid for two parameters, in general a hypergrid, as an example.
Regularly-Spaced Sequences
These are sequences of values that are evenly distributed across a specified range.
Endpoints
The from and to arguments to seq.
Some parameters have natural upper/lower bounds.
The size of a moving average window is
* lower bounded by 0.
* upper bounded by the length of historical data available.
Increments
Suppose you have already decided on endpoints:
- Estimate backtest time for one parameter combination.
- Based on how long you have to run the backtest determine the number of parameter combinations to test.
- Test the same number of parameter values for each parameter to achieve a total close to the target