The resource loading... loading...

The three main pitfalls of parametric optimization are forward bias, over-optimization, and curve fitting.

Author: Inventors quantify - small dreams, Created: 2017-11-24 14:11:14, Updated:

When many quantitative traders first optimize their parameters, they are more or less likely to make three types of errors: forward bias, over-optimization, and curve matching. These three traps are catastrophic when they occur during strategy development and parameter optimization.

First of all, we are talking about forward bias, which refers to the development of strategies that take into account some information about the future, which is basically impossible to achieve in real-time operations. Forward bias mainly manifests itself in two aspects, one is the future function and the other is the signal flash.

  • Future functions

    For example, if the rule of a future function is to open a trade at the opening price when the current price crosses the trade line, for ease of reference, we will give this strategy a name, called the future A, the future A is a typical strategy that uses the future function, because at the time of opening you can not know if the line K is finally able to break the trade and send an open position signal, the future A uses a future price to decide the previous buy.

  • Theft

    There is also a situation called steal price, which is actually a function of the future. For example, a high-frequency strategy, which we will temporarily name as the A-tick, the A-tick strategy, the rule is that when the price breaks the highest price of the day, the A-tick is opened at the highest price of the day. The A-tick seems to be no problem, but note that the break means higher than, that is, at least one degree higher than the highest price of the day to be called a breakthrough, that is, the condition to satisfy the A-tick is to call the breakout immediately when the current price = the highest price of the day + 1 tick.

    Don't underestimate the error of this tick, for example, with a screwdriver, assuming 250 trading days a year, and each trading day executes a buy and sell, then the whole year is 500 ticks, 500 tick slippage cost will exceed your capital. The reality is that it is not only impossible to get you a trade at a price lower than one tick, but more cases are higher than one or even more tick price, the reason is simple, most trend traders signals are almost the same, at a certain key point the build up signal (such as breaking the highest price on a certain day) will form a competition in front of many trend traders, everyone competes to lose first, these competitions cause price losses to form sharp waves at key positions, and these waves are usually programmatically dynamic.

  • The signal flashes.

    Next, let's talk about signal flashing, if another rule of the equatorial strategy is: when the closing price is above the equator, open a trade to break the price, we still give it a name, let's say the strategy is called a signal flashing B. The flashing B is a strategy where there is a signal flashing, and the flashing B is not as intuitive to see the problem in the test as the flashing A in the future, but once the flashing B is used in the real world, you will find the problem there. Because when in the disk, the system will default to the current price being the close, the current price is higher than the breakout price and will send a buy signal, but if the price is below the equator at the close, then the trade signal will disappear, but you have already made a trade, this signal is called a flash.

    Future function and signal flashing, which we collectively call forward bias, flashing B and flashing A have one thing in common, which is that they use the future price to determine the previous buy and sell, which is a mistake we try to avoid.

  • Over-optimization and curve fitting

    Speaking of over-optimization and curve fitting, over-optimization refers to optimizing several parameters of a strategy repeatedly to the best, and then formulating a strategy and controlling risk based on the best parameters obtained. Obviously, even a strategy that cannot make money can be profitable with individual parameters if it is optimized by violence, but this result is difficult to profit from in the future.

    There are two effective ways to avoid over-optimization: one is to use fewer parameters, and the fewer parameters, the fewer projects that can be optimized. Natural over-optimization can be well avoided, and the fewer parameters built, the more robust the strategies are often, regardless of their timeliness or robustness.

    The second way to avoid over-optimization is to do historical backtesting with the default parameters of a strategy, or to test a strategy with multiple sets of random parameters, which should be further developed if the strategy is profitable with either the default or random parameters; conversely, if a strategy is profitable with only a few parameters, then I recommend that you definitely abandon the strategy.

    Curve matching and over-optimization are similar, meaning adding some unnecessary rules to match historical data. For example, a stock strategy, we call it a "C" matching strategy, which provides a three-year time to do bullish trading, and a three-year time to do trend trading. Assume that a "C" matching strategy was tested from January 2010 and was a bullish rule until December 2012, a "C" matching strategy from January 2013 to December 2015 and a "C" matching strategy from January 2016.

    The method of avoiding curve fitting is similar to over-optimization, which is to use as few rules as possible to construct a trading system. Anyone with a little common sense in mathematics knows that a 2-fold function will fit a one-turn market, a 7-fold function will fit a six-turn market, and just adding an additional rule will fit a one-turn market, so that the strategy that is fitted will achieve a 100% probability of success, but this is meaningless whether it is a generalization of history or a prediction of the future.

    Using forward-looking bias, over-optimization, and curve-fitting strategies all have one thing in common, which is that the strategy performs very well at the time of feedback, but is not able to enter the real market at all. This is a kind of self-deception, but more often than not, many traders unconsciously make these mistakes in the development of the strategy, using some wrong logic and formulas for feedback, and applying the results of feedback directly to their own expected return and risk management basis.

    So, it is not easy to judge the superiority of the strategy without seeing the code of someone else's strategy, because many of the strategies purchased online, most of them are strategies with these problems, and these problems, which are very few people can be discovered without entering the door of quantitative trading, even if you can buy a really profitable strategy, I have already shown you that you still can not execute this strategy in the long term, so please do not think about taking shortcuts, the strategy must be developed by yourself and build confidence, the sky will not fall down, the pie must be a trap.

Translated from the Python Quantitative Trading Community


More