



Methods for MetricBased Strategy Building by Michael R. Bryant
Metricbased strategy building refers to creating trading strategies by specifying the desired characteristics of the strategy in terms of a set of trading metrics. The strategy building algorithm is responsible for coming up with the trading rules and logic to satisfy the specified metricbased requirements and/or goals. This is in contrast to the traditional approach of specifying the rules and logic and testing the resulting strategy to see if the performance is acceptable. Because the universe of trading metrics is much smaller than the universe of possible trading rules and logic, it's easier to specify a strategy in terms of the former and let the computer perform the more difficult task of coming up with the latter. Adopting this inverse methodology typically results in fewer false starts and converges to an acceptable strategy much faster than the traditional approach.
Because the success of a metricbased building approach depends on choosing the right metrics, this article will discuss three possible methods for selecting a set of trading metrics. Under the right circumstances, any one of these methods  minimalist, targetbased, and iterative  can be used successfully. The advantages and disadvantages of each method will be discussed.
General Considerations for Selecting Build Metrics In order to use a metricbased method for building trading strategies, the strategy building software must contain an algorithm to automatically develop the strategy's trading logic based on the chosen metrics. The generated strategy is then evaluated against the metrics to determine suitability. Some programs use an ad hoc approach to combine rules and/or price patterns. In a previous article, I demonstrated that simple types of strategy logic could be created using a random selection method. However, creating more complex types of entry and exit rules requires a more sophisticated approach, such as genetic programming. This is the basis of Adaptrade Builder, which will be used to illustrate the ideas presented here.
While the universe of trading metrics is much smaller than the universe of trading logic, there is still a wide variety of metrics to choose from when specifying the requirements for a trading strategy. One of the challenges is that many of the metrics are related to one another. This makes it possible to overspecify the requirements. For example, suppose you wanted specific values for the total net profit and number of trades and also had in mind a value for the average trade. Specifying values for each metric would be overspecifying the requirements because the net profit is equal to the average trade multiplied by the number of trades. It's therefore redundant to specify values for all three metrics, and if the values are not consistent, it could make it difficult for the optimization process to find a solution.
The following equations relate some of the more commonly used metrics to one another:
Equation (1) relates the average trade (AT) to the average win (AW), average loss (AL), and percentage of winning trades (PW). Equation (2) simply states that the net profit (NetProf) is the product of the average trade and the total number of trades (NT). Equation (3) states that the total number of bars of data (NBARS) must be at least as large as the product of the number of trades and the average number of bars in trades (NBARS,T).
To avoid overspecifying these metrics, fewer metrics should be specified than the number of metrics in either equations (1) or (2). For example, no more than three of the four metrics in (1) should be specified. If requirements are specified for all four metrics, the requirements will be overspecified since given any three of the four variables in (1), the fourth can be determined from (1). Likewise, in (2), any two of the three can be specified, but setting requirements for all three would be overspecifying.
Equation (3) is a bit different because it's an inequality condition and because it involves the total number of bars of data, which is not a trading metric. However, it's important to keep in mind that when specifying both the total number of trades and the average number of bars in trades that the two are constrained by the total number of bars of data. It would be counterproductive, for example, to request 1000 trades and an average trade length of 50 bars if you're building over fewer than 50,000 bars of data.
Along the same lines, it would overspecifying to set a requirement for the same metric expressed in both dollar and percentage terms, such as specifying an average trade size greater than $100 as well as the average percentage trade size greater than 2%. These two metrics are related, so only one or the other should be used as a build requirement or condition.
Another general consideration in selecting build metrics is that some metrics represent overall strategy quality and can be applied to any strategy. I discussed this previously in the article ConstraintDriven Strategy Design. Examples of conditions or requirements involving these types of metrics include a statistical significance value greater than 98% and the correlation coefficient greater than 0.95. Other such metrics include the profit factor, Sharpe ratio, and the Kelly fraction.
Most other metrics, however, are more specific to the type of strategy you want. For example, the number of trades per day, average bars in trades, percentage of winners, and average win will be different for different types of strategies. A longterm trendfollowing strategy on daily bars, for example, may have fewer than 50% winners with a win/loss ratio greater than 2, and maybe a dozen trades per year per market. A day trading strategy, on the other hand, might have more than 60% winning trades, a win/loss ratio close to 1, with several trades per day.
Lastly, an important consideration for choosing metrics is whether or not the chosen values are reasonable. Just because you set a requirement for your strategy doesn't mean that requirement can be met. As an extreme example, you could set a requirement for the average monthly net profit to be greater than $1,000,000 on a 1contract basis for an Emini S&P strategy. Obviously, setting that condition doesn't guarantee that result. More commonly, a series of conditions may appear to be reasonable but is beyond the profit potential of the market. To avoid this, preliminary building and testing can be performed to get a better idea of the profit potential of the market.
A Minimalist Approach At one end of the spectrum of methods for metricbased strategy building is a minimalist approach. Here, the only metric you use is net profit, and the goal is simply to maximize the net profit. In Adaptrade Builder, the Metrics window would appear as shown below in Fig. 1.
Figure 1. Build metric for a minimalist method of metricbased strategy building.
The weight value in this case is arbitrary. The idea behind this approach is that by maximizing the net profit, all the other metrics will fall into line. In other words, if the strategy's net profit is maximized, it will also have the highest profit factor, the lowest drawdown, the straightest equity curve (on a fixedcontract/share basis), and so on.
Advantages: Simple.No risk of overspecifying requirements. Unbiased. Doesn't assume anything about the kind of strategy you're looking for or what range of metric values is reasonable. Same metric conditions can be used for any market.
Disadvantages: Greater potential for overfitting.Without any limit on complexity and with no specified limit on requested performance, the build algorithm may fit the noise, rather than just the signal, in an attempt to maximize the profit. Doesn't allow for specific requirements, such as a certain number of trades per day or a high percentage of winning trades. With only the net profit to guide the build algorithm, the build process may be more erratic.
Recommendations for Use: To avoid overfitting, add complexity as a build objective with a small weight, use more price data, and consider building with Monte Carlo analysis.Add one or more of the generalpurpose, strategy quality metrics, such as significance or correlation coefficient, as a build objective to help improve the build process.
A TargetBased Approach This method is at the opposite end of the spectrum from the minimalist approach. Rather than using a very simple set of metrics, in this approach, you set a detailed set of requirements to target exactly what you want. I discussed this approach previously in the article Reverse Engineering a Trading Strategy.* In that article, I used the results from an existing trading strategy that had been profitable in realtime tracking to establish a set of build conditions. Fig. 2 below illustrates how that reverseengineered strategy ("MiniMax Clone") has held up since the article was published in 2011. The results since the strategy was created using the targetbased approach are positive, as shown by the curve to the right of the red line.
Figure 2. Equity curve from MiniMax Clone strategy. Results since release are shown to right of red line.
Another example of the targetbased approach is shown in Fig. 3 below using metrics from the actual results of a trading strategy I found posted online.
Figure 3. Example of build metrics for a targetbased method of metricbased strategy building.
The build objectives in the top box of Fig. 3 are very simple. These are the metrics that you're minimizing or maximizing. The build conditions in the middle box are where you target the metrics. In this example, metrics have been targeted for the net profit, number of trades, percentage of wins, win/loss ratio, and the maximum drawdown. Notice that a range of values is used for each metric because achieving an exact duplication is unlikely.
Advantages: Works well if you have real results that you want to duplicate.Minimal risk of overfitting if you duplicate a trading strategy with a solid, realtime track record. No question as to whether metric values are reasonable or achievable. Tends to converge well.
Disadvantages: Finding suitable trading results to duplicate is not easy.Even with profitable real trading results, success is not guaranteed. A profitable strategy can still fail if it's overfit and has merely been lucky.
Recommendations for Use: Try to duplicate as many aspects of the trading strategy as possible, such as the symbol and bar size, types of entry and exit orders, whether it's longonly, long/short, or shortonly, and so on.Build with a relatively large number of generations to give the build algorithm time to meet all the different build conditions. Don't assume the generated strategy is viable just because you were able to duplicate the metrics. Track the results of the generated strategy in real time prior to trading and/or test it outofsample just as you would any other trading strategy to asses the viability of the strategy prior to trading.
An Iterative Approach If you don't have a specific set of trading results to duplicate and you want more control over the strategy results than you can get from a minimalist approach, an iterative approach is probably called for. This is where you would perform one or more preliminary builds using a pareddown set of metrics, such as the default ones provided in Adaptrade Builder, and use the results of that build, along with any specific requirements you have, to select a more complete set of metrics. After building with those metrics, you would examine the results and change the metrics as necessary to address anything you didn't like about the results. For example, if the top strategies consistently had trades with large open losses, you could add a condition for the maximum adverse excursion (Max MAE). The process could then be repeated until the results met your requirements.
An example of this approach was followed in the recent article ShortTerm ProfitBased Strategies. The figure below is copied from Fig. 3 of that article and shows the metrics used in the final build for a shortterm Emini S&P strategy.
Figure 4. Example of build metrics for an iterative method of metricbased strategy building.
As with the targetbased approach (Fig. 3), the build objectives in Fig. 4 are fairly simple and consist of basic metrics that can be applied to any strategy build project. The build conditions, on the other hand, consist of a combination of general metrics (correlation coefficient and significance) and ones that are more specific to the strategy being built (profit factor, Max MAE, and average bars in losses). Fig. 4 also illustrates the use of "Conditions for Selecting Top Strategies", which provides a set of conditions to filter out the strategies that satisfy all the desired metrics.
Advantages: Flexible.Allows for specific requirements to be set. Doesn't require prior knowledge of market or initial values for metrics of build conditions.
Disadvantages: Timeconsuming.Iterative nature means more steps are required. Overspecification of requirements is possible. Risk of setting requirements that are either unrealistic or, conversely, too easy to achieve.
Recommendations for Use: Use a smaller population and fewer generations at first so that the initial builds don't take too long.Finding a good set of build conditions may take several iterations. Once you start to get good strategies, the population size and number of generations can be increased. If using the "Reset on outofsample performance" option in Builder, set aside a third segment of data to use for validation, as illustrated in ShortTerm ProfitBased Strategies.
Conclusions Metricbased strategy building can be a highly effective way to build trading strategies, but choosing a good set of metrics requires some thought. This article looked at three different methods for choosing the metrics. The minimalist approach is probably best for when you don't have specific requirements and want the best overall strategy for the given market or markets, although particular care should be taken to minimize the risk of overfitting. A targetbased or reverseengineering approach can be effective if you have or can find suitable realtime trading results to replicate. The iterative approach tends to be the default method when you want more control over the resulting strategies but don't have prior knowledge of specific values for metric requirements.
Any one of the methods discussed here can be used to successfully build trading strategies using a tool like Adaptrade Builder. Regardless of the approach you follow, the section "General Considerations for Selecting Build Metrics" should provide some basic guidance.
Although building strategies by specifying the trading metrics and letting an algorithm construct the trading logic is the inverse of the usual approach to strategy building, the same admonishments apply: beware of overfitting and test outofsample and in realtime tracking to validate performance prior to trading.
Good luck with your trading.
Mike Bryant Adaptrade Software
____________
* Although the targetbased method can be thought of as a "reverseengineering" approach, duplicating the results of an existing trading strategy doesn't mean you're necessarily duplicating the internal logic. In all likelihood, there are many different sets of trading rules that are functionally equivalent and therefore generate the same results.
This article appeared in the October 2014 issue of the Adaptrade Software newsletter.
HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN INHERENT LIMITATIONS. UNLIKE AN ACTUAL PERFORMANCE RECORD, SIMULATED RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, SINCE THE TRADES HAVE NOT ACTUALLY BEEN EXECUTED, THE RESULTS MAY HAVE UNDER OR OVERCOMPENSATED FOR THE IMPACT, IF ANY, OF CERTAIN MARKET FACTORS, SUCH AS LACK OF LIQUIDITY. SIMULATED TRADING PROGRAMS IN GENERAL ARE ALSO SUBJECT TO THE FACT THAT THEY ARE DESIGNED WITH THE BENEFIT OF HINDSIGHT. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFITS OR LOSSES SIMILAR TO THOSE SHOWN. 
If you'd like to be informed of new developments, news, and special offers from Adaptrade Software, please join our email list. Thank you.
For Email Marketing you can trust


Copyright (c) 20042019 Adaptrade Software. All rights reserved.