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 MetricsMost 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
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.
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
Down capture ratio
Up percentage ratio
Down percentage ratio
Absolute Risk Measures
Relative Risk Measures
Tail Risk Measures
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)
Money Management TechniquesHaving 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 OptimizationOptimization 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 portfolioIn 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 positionsWe 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 settingsThese 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 goalOptimization 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 portfolioIn 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 returnsIn 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 ConcludeIn 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 StepIf 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!
Disclaimer: All investments and trading in the stock market involve risk. Any decisions to place trades in the financial markets, including trading in stock or options or other financial instruments is a personal decision that should only be made after thorough research, including a personal risk and financial assessment and the engagement of professional assistance to the extent you believe necessary. The trading strategies or related information mentioned in this article is for informational purposes only.