A brute force optimizer searches for the best possible solution by systematically testing all potential solutions, i.e., all definable combinations of rules, parameters, or both. Because every possible combination must be tested, brute force optimization can be very slow. Lack of speed becomes a serious issue as the number of combinations to be examined grows. Consequently, brute force optimization is subject to the law of “combinatorial explosion.” Just how slow is brute force optimization? Consider a case where there are four parameters to optimize and where each parameter can take on any of 50 values. Brute force optimization would require that 504 (about 6 million) tests or simulations be conducted before the optimal parameter set could be determined: if one simulation was executed every 1.62 seconds (typical for TradeStation), the optimization process would take about 4 months to complete. This approach is not very practical, especially when many systems need to be tested and optimized, when there are many parameters, when the parameters can take on many values, or when you have a life. Nevertheless, brute force optimization is useful and effective. If properly done, it will always find the best possible solution. Brute force is a good choice for small problems where combinatorial explosion is not an issue and solutions can be fond in minutes, rather than days or years.
Only a small amount of programming code is needed to implement brute force optimization. Simple loop constructs are commonly employed. Parameters to be optimized are stepped from a start value to a stop value by some increment using a For loop (C, C+ +, Basic, Pascal/Delphi) or a Do loop (FORTRAN). A brute force optimizer for two parameters, when coded in a modem dialect of Basic, might appear as follows:
Because brute force optimizers are conceptually simple and easy to program, they are often built into the more advanced software packages that arc available for traders.
As a practical illustration of bmte force optimization, TradeStation was used to optimize the moving averages in a dual moving-average crossover system. Optimization was for net profit, the only trading system characteristic that Trade- Station can optimize without the aid of add-on products, The Easy Language code for the dual moving-average trading model appears below:
The system was optimized by stepping the length of the first moving average (LenA) from 2 to 10 in increments of 2. The length of the second moving average (LenB) was advanced from 2 to 50 with the same increments. Increments were set greater than 1 so that fewer than 200 combinations would need to be tested
(TradeStation can only save data on a maximum of 200 optimization runs). Since not all possible combinations of values for the two parameters were explored, the optimization was less thorough than it could have been; the best solution may have been missed in the search. Notwithstanding, the optimization required 125 tests, which took 3 minutes and 24 seconds to complete on 5 years of historical, end-ofday data, using an Intel 486 machine running at 66 megahertz. The results generated by the optimization were loaded into an Excel spreadsheet and sorted for net profit. Table 3-l presents various performance measures for the top 25 solutions.In the table, LENA represents the period of the shorter moving average,
LENB the period of the longer moving average, NetPrft the total net profit, LtNerPlft the net profit for long positions, S:NefPrji the net profit for short positions, PFact the profit factor, ROA the total (unannualized) return-on-account, MaxDD the maximum drawdown, #Trds the total number of trades taken, and %Prji the percentage of profitable trades.
Since optimization is a problem-solving search procedure, it frequently results in surprising discoveries. The optimization performed on the dual movingaverage crossover system was no exception to the rule. Conventional trading wisdom says that “the trend is your friend.” However, having a second moving average that is faster than the first, the most profitable solutions in Table 3. I trade against the trend. These profitable countertrend solutions might not have been discovered without the search performed by the optimization procedure
Successful user-guided optimization calls for skill, domain knowledge, or both, on the part of the person guiding the optimization process. Given adequate skill and experience, not to mention a tractable problem, user-guided optimization can be extremely efficient and dramatically faster than brute force methods. ‘Ibe speed and efficiency derive from the addition of intelligence to the search process: Zones with a high probability of paying off can be recognized and carefully examined, while time-consuming investigations of regions unlikely to yield good results can be avoided.
User-guided optimization is most appropriate when ballpark results have already been established by other means, when the problem is familiar or well understood, or when only a small number of parameters need to be manipulated. As a means of “polishing” an existing solution, user guided-optimization is an excellent choice. It is also useful for studying model sensitivity to changes in rules or parameter values.
No comments:
Post a Comment