Evaluating Trade Strategy Parameters

Overview


Most trading strategies are dependent on a set of predefined parameters. As an example, the 200 day moving average trend follower will buy an asset if its price is above the 200 day moving average price, and sells the asset short or goes flat otherwise.

In this example, the 200 day moving average is a parameter with value = 200. Of course, it is legitimate to ask how the strategy would perform if the moving average were set to 199 days or 201 days.

Analyzing the robustness of the parameters to a trading strategy is a key element to avoiding overfitting.

Maximizing the Parameters


Given a testing data set and an algorithm for a trading strategy, the strategy can be backtested on the dataset and a performance computed. Assuming that the algorithm is based on a set of parameters, {% p_1, p_2 ... p_n %}, the resulting performance can be written as a function of the parameters as follows.
{% Performance = f(p_1, p_2 ... p_n) %}
In the case of a moving average trend follower, there is only a single parameter, the size of the moving average. It can be written as
{% Performance = f(MovingAverage) %}
The standard procedure for optimizing the trading strategy is then to re-run the strategy with different values of the input parameters, in order to find the combination that maximizes the strategy performance. (Here, the performance may be set to something like total return, or it may be more nuanced such as total risk adjusted returns.)

Generalization and Overfitting


The process of strategy opitimization is similar to the process of loss minimization in machine learning. Similarly, the ability of the trading strategy to perform well out of sample, (in the real world), is parallel to a machine learning algorithm's ability to generalize. And just as a machine learning algorithm can be overfit, a trading strategy can also be overfit. That is, it is very possible that the trade strategy has been fit to the data, but not able to perform well outside the test set.

Keep Number of Parameters Low :
Regularization :
Performance Insensitivity to Parameter : another strategy to prevent overfitting is to choose a parameter in a region where the performance does not change much when the parameter is altered a little.

As an example, consider a trend following algorithm that uses a 50 day moving average to determine trend. Assume that the algorithm has been backtested on test data and has performed well. Now, test the same algorithm with a 51 day moving average, and a 49 day moving average. If the strategy fails to perform well with these minor variations, it is likely to have been overfit. (see Tomasini)

Contents