Risk Management

Mitigating overfitting on Trading Strategies

rcobo

04/12/2019

No Comments

According to Wikipedia “in finance, a trading strategy is a fixed plan that is designed to achieve a profitable return by going long or short in markets. The main reasons that a properly researched trading strategy helps are its verifiability, quantifiability, consistency, and objectivity. For every trading strategy, one needs to define assets to trade, entry/exit points, and money management rules. Trading strategies are based on fundamental or technical analysis or both.”

In this post, we analyze the performance of a very common trading strategy: two moving averages crossover. Our system will buy when the short moving average crosses above the long moving average and will sell when a short moving average crosses below the long one. Using twenty years of daily closes of a stock index, we evaluate our strategy for one hundred different length combinations of short and long moving averages. We set short lengths from 10 to 100 and long lengths from 150 to 240. From each choice of parameters we obtain different results. For example:

Historical Prices

CAGR on Historical Prices
Volatility on Historical Prices

Furthermore, we can compare the trading systems performance with the index:

Risk Return Plot on Historical Prices

Many other characteristics can be explored about the performance of a trading strategy: a number of trades, drawdowns, risk/return ratios, rolling windows performances…

Although someone can argue that twenty years is a long enough time interval to test a daily trading strategy, there is an obvious risk in the choice of the parameters. The user wishes not to choose the “best” parameters pair for the twenty years of history analyzed. The user would like to choose a pair (if any) that meets their requirements and that will be able to generalize in the future when the strategy addresses unknown circumstances.

Synthetic Prices

In this blog we have explored the use of Synthetic Generated Financial Time Series several times:

Generating Financial Series with Generative Adversarial Networks

Generating Financial Series with Generative Adversarial Networks Part 2

Mitigating overfitting on Financial Datasets with Generative Adversarial Networks

Taking our twenty years of historical daily prices we generate three hundred of synthetic prices (new “worlds” to test our trading systems) with the same duration. Therefore we can make the strategy will face various market regimes and we will have a better-informed perspective of the trading strategy outcome. In our example, we generate three hundred “new” synthetic generated realizations from our twenty years of available history. We can revisit the previous plots in each different scenario:

CAGR on Synthetic Prices
Volatility on Synthetic Prices
Risk Return Plot on Synthetic Prices

Therefore, each underlying price results in different performances and ratios for each pair of parameters. We have multiplied our available information about the trading system by three hundred. For instance, if we compute median CAGR across all the synthetic scenarios:

Median CAGR across Synthetic Prices

For example, when we examine the median CAGR matrix on synthetic prices, the pair [10, 240], which obtained the best CAGR on historical prices, does not belong to the most profitable set of pairs.

Remarks

We start from the same input, twenty years of daily prices. However, after
evaluating the strategy on synthetic generated prices, we reach a much deeper understanding of the trading strategy’s pros and cons. In conclusion:

  • For each pair of parameters, we now obtain a distribution of possible outcomes (CAGR, Volatility, Drawdown…).
  • We can observe the performances of the system in market regimes that are not seen on historical prices.
  • We are more prepared to avoid “false positives”.