The performance of a trading strategy is measured with a set of parameters. For example, if you are trading in equity then your returns are compared against the benchmark index. The consistency of returns of the strategy also proves to be a significant factor.Did the strategy perform well when the index suffered? The strategy would be deemed successful even if it has incurred loss but has lost less than the index. The first part of the article looks at such commonly used performance metrics that give us an insight into the anatomy of a trading strategy.

When asked what the stock market will do, Benjamin Graham said, “It will fluctuate”. There is no sweeping method by which one can predict the exact movement of the market direction. Forecasting methods involving various techniques always come with an element of risk. Hence, it is important that risk metrics are computed along with the performance metrics.

Let us have a look at some of the performance metrics and in the second part of the article, we cover the risk metrics. The final part explains strategy optimization in brief with a simple example.

**Performance Metrics**

Most of the performance metrics revolve around the risk factor. We will consider the absolute risk-adjusted measures and the relative return measures in this section.

**Absolute Risk-Adjusted Measures**

**Sharpe ratio**

It is a measure of the excess return per unit standard deviation in an investment asset. It provides useful information regarding the return of an asset for a given risk.

Limitations: It is based on historical data thus assuming future would be a repetition of past. It does not give a clear picture of tail risk. It does not account for transaction costs and maximum drawdowns.

**Sortino ratio**

It is the modified version of Sharpe ratio wherein the standard deviation of negative returns is considered. It is the portfolio returns minus risk-free returns divided by downside (negative) standard deviation.

**Calmer ratio**

Calmar Ratio also called the Drawdown ratio is calculated as the Average Annual rate of return computed for the latest 3 years divided by the maximum drawdown in the last 36 months.

The higher the ratio, the better is the risk-adjusted performance of the trader or commodity trading advisor (CTA) in the given time frame of 3 years.

**Relative Return Measures**

**Up capture ratio**

A statistical measure that measures fund’s return with respect to the benchmark’s return. A ratio greater than 100 indicates that the fund has outperformed the index.

**Down capture ratio**

A statistical measure that measures fund’s return with respect to the benchmark’s return. A ratio less than 100 indicates that the fund has outperformed the index.

**Up percentage ratio**

It is a measure of a number of periods that a fund outperformed the benchmark when the benchmark was up divided the number of periods that the benchmark was up. Higher the ratio better is the performance of the fund.

**Down percentage ratio**

It is a measure of a number of periods that a fund outperformed the benchmark when the benchmark was down divided the number of periods that the benchmark was down. Higher the ratio better is the performance of the fund.

**Risk Metrics**

**Absolute Risk Measures**

**Variance**

Variance expresses how much the rate of return deviates from the expected return i.e. it indicates the volatility of an asset and hence is consider as a risk indicator which can be used by the portfolio manager to assess the behavior of the assets under consideration.

**Maximum Drawdown**

Maximum Drawdown indicates the downside risk of a portfolio over a specified time period. It signifies the maximum loss from a peak to a trough of a portfolio’s equity and is expressed in percentage terms.

**Relative Risk Measures**

**Correlation coefficient**

Correlation coefficient just gives information about the strength of correlation between two variables. It takes values between -1 and 1, where a -1 means that the variables move opposite of each other, while 1 means that they move in tandem.

**Beta**

Beta measures the volatility of a stock/portfolio in relation to the market. A portfolio with a beta greater than 1 is considered to be more volatile than the market; while a beta less than 1 means less volatility. Beta values are not bounded like the correlation values.

**Tail Risk Measures**

**Value-at-Risk (VaR)**

This popular risk metric measures the potential loss in the value of a risky asset over a defined period for a given confidence interval.

For example, if the VaR for an asset is at 10 million at 99% percent confidence level, then it means that in 1% of cases the loss will exceed the VAR amount. However, one should note that VaR does say anything about the size of the losses within this 1%.

**Conditional Value-at-Risk (CVaR)**

Conditional Value-at-Risk also known as Expected Shortfall (ES) is computed by taking a weighted average between the VaR value and the losses exceeding VaR. CVaR is seen as an extension of VaR and is considered superior to VaR.

**Money Management Techniques**

Having discussed various performance metrics, let us have a look at the money management techniques. What portion of your wealth should you devout towards trading? How do you decide on the amount you should invest? In laymen terms, don’t invest more than what would make you sleepless. Some of the metrics discussed above could be considered. Maximum drawdown could be a deciding factor in limiting your portfolio losses. To see how ugly math can be, consider a simple example. Suppose you have invested 100 rupees and unfortunately, you lost 60% due to extreme market movement. Not that your worth is 40 rupees, to bring it back to your initial value you have to make a gain of 250%!

Martingale method is another criterion to position the trade size. This involves increasing your bets after every loss and decreasing it after every win. The anti-martingale method works on the opposite logic. A famous criterion known as Kelly’s criterion or Kelly’s formula is used to determine the optimal size of the bets. It is focused on the long-term capital growth. It takes into account winning probability as well as average wins and average losses.

**Strategy Optimization**

Optimization forms a very important step in the strategy development process. Optimization allows a strategist to improve upon the results of his strategy by fine tuning the parameters and the formulae that drive the strategy. Optimization can be done by fine tuning a single parameter or a set of parameters to achieve the desired optimization objective. An example of strategy optimization objective can be maximizing the total profits generated. Another objective of optimization can be minimizing the drawdowns.

Having mentioned the purpose of optimization, one should also be aware that optimization is like a double-edged sword. If many rules are applied on training data during optimization to achieve the desired equity curve, it results in over-fitting of the data and the model is likely to lose it forecasting ability on the test and future data.

Portfolio optimization software forms an important component of strategy development platforms. However, one should note that different platforms can offer different strategy optimization tools and techniques. Hence, one should evaluate the optimization tools available before subscribing to any strategy development platform.

**Strategy Optimization ****Example:**** **

Let us take an example of a simple strategy and use the “PortfolioEffectHFT” package to optimize the strategy performance.

The “PortfolioEffectHFT” package is built by PortfolioEffect and can be used for backtesting high frequency trading (HFT) strategies, intraday portfolio analysis, and optimization. It also includes auto-calibrating model pipeline for market microstructure noise, risk factors, price jumps/outliers, tail risk (high-order moments) and price fractality (long memory).

Given below are the steps to create a portfolio and then perform portfolio optimization using “PortfolioEffectHFT”.

**Step 1: Create a portfolio**

In this step, we create a new asset portfolio and specify the time interval. This time interval will be considered as the default position holding period unless positions are added using rebalancing.

portfolio = portfolio_create(fromTime="2016-06-01 09:30:00", toTime="2016-06-01 16:00:00")

**Step 2: Add positions**

We add positions to the portfolio object by calling the position_add method. In this case, we take positions in Alphabet Inc. (ticker: GOOG) and Citigroup Inc. (ticker: C)

positionC = position_add(portfolio,'C',500) positionGOOG = position_add(portfolio,'GOOG',600)

**Step 3: Set the desired portfolio settings**

These settings determine how portfolio returns and return moments are computed. For example, the “resultsSamplingInterval” parameter Interval to be used for sampling computed results before returning them to the caller.

portfolio_settings(portfolio, portfolioMetricsMode='price', resultsSamplingInterval='30m')

**Step 4: Set optimization goal**

Optimization algorithm requires a single maximization/minimization goal to be set using the optimization goal() method. This method operates on the portfolio object created in the above steps. Let us set our goal to maximize the log returns of our portfolio. The package allows for setting different optimization goals like portfolio Value-at-Risk, Sharpe Ratio, Variance etc.

optimizer = optimization_goal(log_return(portfolio),"max")

**Step 5: Launch optimization and obtain optimal portfolio**

In this step, the returned optimizer object is passed to the optimization_run method to perform portfolio optimization which uses a multi-start portfolio optimization algorithm.

optimalPortfolio = optimization_run(optimizer)

**Step 6: Plot the Normal Portfolio versus Optimal Portfolio returns**

In this example, our objective was to maximize the log returns of the portfolio in the given time interval. The final results are shown in the plot below.

plot(log_return(portfolio),log_return(optimalPortfolio),title="Portfolio Return", legend=c("Simple Portfolio"," Optimal Portfolio"))

**To Conclude**

In this post, we looked at some of the commonly used portfolio metrics and also covered the strategy optimization concept with an example using the ‘PortfolioEffectHFT” package.For a detailed study, one needs to explore the different available portfolio metrics and learn the various optimization techniques used by market practitioners.

To learn more on the subject, you can watch the webinar, “Alpha Generation: Controlling Intraday Risk Profile” hosted by QuantInsti™ and conducted by Stephanie Toper, Director of Portfolio Analytics, PortfolioEffect. The webinar was held on January 10, 2017.

**Next Step**

If you want to learn various aspects of Algorithmic trading then check out the Executive Programme in Algorithmic Trading (EPAT™). The course covers training modules like Algorithmic & Quantitative Trading, Statistics & Econometrics, and Financial Computing & Technology. Enroll now!