Free email newsletter with articles on systematic trading

 

 

 

 

 

 

Adaptrade Software Newsletter Article
 

 

Methods for Metric-Based Strategy Building

by Michael R. Bryant

 

 

Metric-based 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 metric-based 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 metric-based 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, target-based, 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 metric-based 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 over-specify 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 over-specifying 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:

 

  AT = PW * AW + (1 - PW) * AL (1)
  NetProf = AT * NT (2)
  NBARS >= NBARS,T * NT (3)

 

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 over-specifying 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 over-specified 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 over-specifying.

 

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 counter-productive, 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 over-specifying 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 Constraint-Driven 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 long-term trend-following 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 1-contract basis for an E-mini 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 metric-based 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.

 

Build metrics for a minimalist method of metric-based strategy building.

Figure 1. Build metric for a minimalist method of metric-based 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 fixed-contract/share basis), and so on.

 

Advantages:

bulletSimple.
bulletNo risk of over-specifying requirements.
bullet Unbiased. Doesn't assume anything about the kind of strategy you're looking for or what range of metric values is reasonable.
bulletSame metric conditions can be used for any market.

 

Disadvantages:

bulletGreater potential for over-fitting. 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.
bulletDoesn't allow for specific requirements, such as a certain number of trades per day or a high percentage of winning trades.
bulletWith only the net profit to guide the build algorithm, the build process may be more erratic.

 

Recommendations for Use:

bulletTo avoid over-fitting, add complexity as a build objective with a small weight, use more price data, and consider building with Monte Carlo analysis.
bulletAdd one or more of the general-purpose, strategy quality metrics, such as significance or correlation coefficient, as a build objective to help improve the build process.

 

A Target-Based 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 real-time tracking to establish a set of build conditions. Fig. 2 below illustrates how that reverse-engineered strategy ("MiniMax Clone") has held up since the article was published in 2011. The results since the strategy was created using the target-based approach are positive, as shown by the curve to the right of the red line.

 

Real-time tracking results of MiniMax Clone strategy.

 Figure 2. Equity curve from MiniMax Clone strategy. Results since release are shown to right of red line.

 

Another example of the target-based approach is shown in Fig. 3 below using metrics from the actual results of a trading strategy I found posted online.

 

Build metrics for a target-based method of metric-based strategy building.

Figure 3. Example of build metrics for a target-based method of metric-based 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:

bulletWorks well if you have real results that you want to duplicate.
bulletMinimal risk of over-fitting if you duplicate a trading strategy with a solid, real-time track record.
bulletNo question as to whether metric values are reasonable or achievable.
bulletTends to converge well.

 

Disadvantages:

bulletFinding suitable trading results to duplicate is not easy.
bulletEven with profitable real trading results, success is not guaranteed. A profitable strategy can still fail if it's over-fit and has merely been lucky.

 

Recommendations for Use:

bulletTry 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 long-only, long/short, or short-only, and so on.
bulletBuild with a relatively large number of generations to give the build algorithm time to meet all the different build conditions.
bulletDon'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 out-of-sample 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 pared-down 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 Short-Term Profit-Based Strategies. The figure below is copied from Fig. 3 of that article and shows the metrics used in the final build for a short-term E-mini S&P strategy.

 

Build metrics for an iterative method of metric-based strategy building.

Figure 4. Example of build metrics for an iterative method of metric-based strategy building.

 

As with the target-based 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:

bulletFlexible. Allows for specific requirements to be set.
bulletDoesn't require prior knowledge of market or initial values for metrics of build conditions.

 

Disadvantages:

bulletTime-consuming. Iterative nature means more steps are required.
bulletOver-specification of requirements is possible.
bulletRisk of setting requirements that are either unrealistic or, conversely, too easy to achieve.

 

Recommendations for Use:

bulletUse 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.
bulletIf using the "Reset on out-of-sample performance" option in Builder, set aside a third segment of data to use for validation, as illustrated in Short-Term Profit-Based Strategies.

 

Conclusions

Metric-based 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 over-fitting. A target-based or reverse-engineering approach can be effective if you have or can find suitable real-time 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 over-fitting and test out-of-sample and in real-time tracking to validate performance prior to trading.

 

Good luck with your trading.

 

Mike Bryant

Adaptrade Software

 

____________

 

* Although the target-based method can be thought of as a "reverse-engineering" 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 OVER-COMPENSATED 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.

 

Join Our Email List
Email:  
For Email Marketing you can trust

 

 

 

Copyright 2004-2015 Adaptrade Software. All rights reserved.