Before you start talking about optimizing a trading system, it’s important to know what these systems are based on or why you should work with them. In this article, we’ll talk about one of the most popular trading tests that exist today. It is the walk-forward test.
What Is the Optimization of a Trading System?
We have all asked ourselves the question of what optimisation is. The optimization of a trading system is based on the study of history of past premises or events. This is done in order to get a number of values to render our system cost-effective. In other words, it is based on carrying out a relevant study about the best results that have occurred in the past, this seeking to obtain a range of possible positive results for the market in which one is working.
Since optimization is based on finding possible numbers or values that approximate or resemble possible current values, it is necessary to take into account that you must have prior market information or valid premises. When you want to perform an optimization of a trading system, it is necessary to take into account the type of objective function you are working with. This is because, for each type of objective function, its values are different.
The objective function with which you are working can be framed in any of the ratios to evaluate systems. All these ratios are based on different ways of working, from here arises the difference between the values that can be given. For example, an objective function may be for the system to have the maximum net gain possible or the minimum possible loss. Depending on this, the parameters of our system can be different.
Ratios for Evaluating Systems
The ratios for evaluating systems are based on the ways you can look for a gain. These give you an assessment of the risk there may be, how profitable it may be, the duration and profitability of profits, among others. To optimize a trading system, you need to be clear about the ratio to maximize or the one you want to prioritize. Thus, when performing the optimization you will look for the results obtained in previous periods and guide you in the possible values to which you can decline.
There are several types of ratios to evaluate the system, I explain three in this article:
Net Profit Ratio
This is one of the most elementary proportions, you can understand it simply as the profitability of the system. This profit is calculated in relation to the initial investment. It’s one of the simplest ways to calculate. However, it is necessary to assess certain circumstances to see whether this system is profitable in the market being operated. In some cases, this system only works within a limited time. Later, you start to generate higher losses, which compared to profits can be disposable.
You should also evaluate the number of trades you can make a profit on, as there may also be a limited number of trades in which you will receive a profit (minimum 150 trades in my case but it varies depending on the type of system). After this, you can only generate losses from your capital.
Ratio through the Drawdown
Many people use Drawdown to opt-out of a trading system. Drawdown is based on the number of consecutive losses in your trading strategy. That is, it is evaluated from the highest point that could be obtained previously, to the lowest point obtained before generating another high point. It is important to note that optimization, in these cases, should have a good margin of error and not fall into over-optimization.
The use of R2 or the coefficient of determination for statistical models whose main objective is the prediction of future results based on other related information. The R2 value is a number between 0 and 1 and describes how well a regression line fits a data set. When the value of R2 is close to 1, this indicates that the regression line fits the data very well, while a value of R2 close to 0 is an indication that the regression line is not adjustable in any way to the data. The higher the value of R2, the better the capital curve of the trading system. A very high R2 value should result in a profitable trading system with little drawdown.
This word is very important when performing the optimization of a trading system, since its result will depend on the study of optimization trading. Simply put, doing a backtest is performing and evaluating a history of operations. With this, you get a percentage of hits, the amount of drawdown or net profit, among others. These data are used as results to enter future parameters, seeking to obtain a benefit. The backtest needs to be done with certain variants. The more variants that emerge, the more backtest you’ll have to do until you hit a closed result, but be very careful with over-optimisation.
What is Over-Optimisation?
In the optimization of a trading system, we look for the possible values that can be generated in the future. This is done by evaluating an earlier historical and a number of previous variants. The over optimization is to play with the marked cards. It is to set the parameters for the best past results. When many backtests are performed, the result gets closer to a point of non-existent perfection. That is, a point where there are no faults or margins of error. When this happens, it is because of a saturation of the variants.
This saturation is called over-optimization. It is one of the factors to which one must be very careful when optimizing a trading system. Because when you over-optimize a system, the perfect result, it’s just a big value error. To prevent you from entering an over-optimized, it is advisable to do an optimization with few parameters to optimize. By entering many parameters, you can fall into over optimization. In my case, in fact, I try not to optimize anything.
What is Walk Forward Optimization?
This is one of the most robust optimization systems available today. This is because it performs a complete optimization, but a little late and complex. Thanks to its system being a bit complex, if you have a considerable historical, your results can become numerous. In other words, the more historical you have, the more results you can get.
What makes the Walk Forward so good, if it gives numerous results? The Walk Forward is considered to be one of the most robust optimizers as it optimizes through historical intervals. This amount of results can be reduced. However, be careful not to over-optimize. The optimization using the Walk forward system is performed by analyzing short intervals in the history of market operations. That is to say, when you have a history of 10 years, for example, you take the first three years (1, 2, and 3) of history, they are optimized and you get the backtest.
After this, it is taken from the last year of the first optimization, until the subsequent two years, including the first backtest. In other words, in the second optimization the years 3, 4, and 5 would be taken, together with the first backtest. This will be done with all the following years until the last backtest. Which will be the result of continuous optimization throughout the history. This constant and repetitive optimization is what is considered as the Walk Forward and, thanks to its level of complexity, is considered as one of the most robust. However, it usually gives very accurate results, within the margin of error.
For what purpose is optimization with walk forward used in trading systems? The function with which this type of optimization is performed is based on the verification of the system for the future. In the same way, you can implement it to obtain possible values that generate a profit. All this is done with a series of premises. That is, you must do it with a history of operations. By doing so, you can get an idea about the market in the future. In this way, you will be able to observe if it can be productive to apply the trading strategy that you are evaluating. In certain cases, you will check that the profitability of the system or ratio is only temporary.
A Correct Optimization
As you know, you should avoid over-optimization, as this does not generate more than losses. One of the points you should look at when performing an optimization of a trading system is to avoid single or isolated values. Imagine creating a strategy based on an average of 20 periods that works perfectly. But when you look at their results with an average of 19 or 21, it’s a complete disaster. Doesn’t sound very reliable, does it?
I don’t mean that your trading strategy works well with any parameter you use. But what we’re looking for are robust systems, and if any sensitive change causes results to be altered abruptly, what we have is not a robust system. Keep in mind that the market can make drastic and abrupt changes. Therefore, it is recommended that you make several optimizations at considerable intervals of time. This ensures that the values obtained the first time, remain constant. If not, the market may make a change, and you should engage with that change.
How to Use the Walk-Forward Test?
In my case, I don’t use it to optimize my trading systems. I use it as a test to evaluate its robustness since when we apply it we are seeing different periods outside the sample. In this way, we obtain more information on how it can behave in the future and on the consistency of the strategy. In the end, as you can see, it’s about having the possibilities in our favor with winning strategies, and this test is throwing information about our strategies. As I always say, don’t look for perfect strategies, look for real strategies.
My recommendation is that you study the test and if it is useful incorporate it into your methodology. For me, it is one of those tests that is worth it along with that of Monte Carlo.