Algorithmic Trading Tips 16.



This issue describes the Sharpe Ratio and its drawbacks, along with an analysis of the Sortino Ratio, which measures the relationship between returns and downward deviation. You will also learn which of the two common gauges best reflects a trading systems’s reward/risk. Including the relevant Equilla code.

WATCH VIDEO NOW. (4 minutes to improve your performance.)
DOWNLOAD WORKSPACE. (For users with Thomson Reuters.)
DOWNLOAD WORKSPACE. (For users with Bloomberg.)

By downloading you agree to the terms of use below.

Performance in terms of raw profit does not reveal all the aspects of a trading system and it is certainly not the best way to appraise it. The risk of the underlying strategy has to be regarded too. A very popular gauge, which describes the relation between return and risk is the Sharpe Ratio. This Trading Tip first describes the Sharpe Ratio and its drawbacks. Subsequently the Sortino Ratio and the associated Equilla code for Tradesignal is presented. Last but not least you will learn which of the two common gauges best reflects the system’s reward/risk.


Originated in 1966 by William F. Sharpe as a performance gauge for mutual funds the Sharpe Ratio is nowadays the industry standard for the evaluation and optimization of investments and trading systems. The formula is the excess return in relation to the standard deviation and describes the reward/risk of the underlying investment:

If an investment has an average annual profit of 10%, the annual risk-free interest rate is at 2% and the standard deviation of annual profits is 5% then the Sharpe Ratio equals:
Sharpe Ratio = (10% – 2%) / 5% = 1,6.

  • The higher the Sharpe Ratio the better the Reward/Risk for the investment.


No matter how useful this formula is – there is a strong popular objection to the Sharpe Ratio as a global mean to gauge the risk-adjusted profitability of a trading system. The central point of this objection regards the use of standard deviation of all returns in the determination of risk: Using both positive and negative returns in the determination of risk, the Sharpe Ratio doesn’t separate “good” from “bad” volatility in performance although volatility which is generated by upward thrusts of the system’s profit curve is intuitively welcomed in contrast to volatility generated by downward thrusts of the curve.

As shown in figure 1, the left profit curve, for example, is seen as riskier than the right one according to the way the Sharpe Ratio perceives risk although intuitively the left curve is much more appealing.


As a more sophisticated example, the Sharpe Ratio might see the same risk in a trend following type of system (which has many small loosing trades and a few amazingly profitable ones) and in a system which systematically shorts uncovered options thus having many small profitable trades and a few very large losses. The distribution of profits of the first system is usually positively skewed¹ whereas the second system has usually a negatively skewed distribution (see figure 2).

But perhaps in the second system there may be much more hidden risk of losing capital due to the possibility of black swan events (sudden extremely rare unfavorable situation for the system).

The Sharpe Ratio defines risk as deviation of returns above or below their mean
It appraises positively and negatively skewed distribution of returns the same way with respect to risk.

  • The Sharpe Ratio defines risk as deviation of returns above or below their mean
  • It appraises positively and negatively skewed distribution of returns the same way with respect to risk.


¹ skewness is a measure of asymmetry for a distribution.


The Sharpe Ratio appraises positive and negative skews the same way.


An alternative Reward/Risk metric to the Sharpe Ratio is the Sortino Ratio which separates upward volatility from downward one and it uses the latter to represent the system‘s risk. The Sortino Ratio was created by Brian M. Rom in 1983 and it derives its name from Frank Sortino who advocated the use of only downside deviation from a desired minimum return as a proxy of risk. The typical discrete formula version of the annual Sortino Ratio commonly used is:

The Sortino Ratio perceives risk only as losses below a threshold and therefore it is focused on the risk of significant loss.

  • The Sortino Ratio regards risk as deviation of returns only below a desired threshold called “Required Rate of Return” (or “Target Return”).
  • It generally regards negatively skewed distribution of returns as more risky than the positively skewed ones.


No matter if you use the Sharpe Ratio or the Sortino Ratio there are problems when it comes to annualization. When profits/losses for period other than yearly are given, a method known as the “square root rule” (multiplication by the square root of a number related to the period of returns) is usually applied to create the annualized Sharpe and Sortino ratios. For example, when daily equity curve for a system is used, an annualized Sharpe Ratio for the system could be:

The problem is that due to various issues (some profound and some hidden) this annualization method has very serious problems and it doesn‘t provide meaningful results. The annual Sharpe Ratio is usually way different from the annualized one provided by the square root rule. The same holds for the Sortino Ratio too. Annualization of both metrics therefore should be generally avoided.


What is a better Reward/Risk gauge to use when comparing trading systems? Well, even assuming that “risk” for you doesn’t just mean instability in performance but it means “risk of losing money”, the Sortino Ratio is not the definite answer to this question as the better gauge depends heavily on the systems’ goals and idiosyncrasy.

Suppose for example that you want to gauge the Reward/Risk profile of a system whose goal is to earn relatively steady profits over time. This means that the system is designed to crunch short term price moves and it doesn‘t try to capitalize on extreme situations. As a consequence, any extremely profitable trade (although pleasant) is most probably attributed to good luck during for example a strong trend. Next time the same strong trend appears, the system may (due to bad luck, this time) have an opposite position thus producing a significant loss. In effect, high upside or downside volatility for the historical performance of this system is indicative of the system’s inability to stay away from extreme situations even though it is designed to avoid them. This is a case (and you will encounter many such cases when you perform optimization of a system’s parameters) where both high upside and high downside volatility in the historical performance of the system are not welcomed so the Sharpe Ratio is a better gauge of Reward/Risk than the Sortino Ratio for this system.

  • The Sharpe Ratio should be preferred if the stability of the equity curve is the focus.

On the opposite, consider a system which targets strong swift directional trends of the underlying and tries to capture as much profit as it can from them. In this case it is only the downside volatility in performance which determines the true risk of losing money for the system because high upside volatility is exactly what the system is trying to achieve. So, the Sortino Ratio is a better gauge in this case.

  • The Sortino Ratio better suits to strategies which target high upside volatility of equity curve (like the trend following strategies).



This short explanation gave you the essential difference between the Sharpe and Sortino Ratio and it also gave you ideas regarding what to take into account before choosing the one ratio over the other to rank your trading systems. In the next step we would like to present you how to apply the Sortino Ratio Indicator in Tradesignal.



While almost any trading analysis software provides Sharpe Ratios, the Sortino Ratio is not so popular. Tradesignal offers the facility to calculate the Sortino Ratio for a trading strategy and plot it as an indicator (namely: Sortino Ratio Indicator or SRI for short) to show how the Ratio evolves along with the equity curve of the strategy over time.

A workspace including this indicator can be downloaded.

The Sortino Ratio Indicator has following important parameters:

  • 01. Capital
    This is the initial capital used by the trading strategy. The default value for the Capital parameter is 100000.
  • 02. SortinoPeriod
    This is the period of the Sortino Ratio in terms of the period of the chart the system is applied. For example, if the strategy is applied in a daily chart and you want the annual Sortino then this parameter could be set at 252 (since a year is approximately 252 trading days) whereas if you want the monthly Sortino you can set it at 21 (since a month is approximately 21 trading days). As another example, if the system is applied in a weekly chart then for the annual Sortino you can set this parameter at 52 and for the monthly Sortino you can set it at 4. The default value for the SortinoPeriod parameter is 21.
  • 03. PeriodsBack
    This input determines how many SortinoPeriods back should be taken into account to calculate the Sortino Ratio. If for example you calculate the annual Sortino and this parameter is at 4 then the calculated annual Sortino Ratio will be based upon four years of historical annual returns. The PeriodsBack parameter can be -1 or any positive integer greater than 3. By setting it to -1 you instruct Tradesignal to calculate the Sortino Ratio taking into account all loaded bars history in a chart. The default value for the PeriodsBack input is 10.
  • 04. Smooth
    Setting Smooth to FALSE will calculate the raw Sortino indicator whereas setting it to TRUE will calculate a smoothed version of the indicator. The default value for the Smooth input is TRUE. The necessity to use a smoothed Sortino indicator stems mainly from the fact that the raw Sortino can be (and usually is) extremely volatile and erratic because the denominator in its formula can be periodically zero or very close to zero. This in turn periodically skyrockets the raw Sortino thus making it practically useless. More precisely, the raw Sortino usually exhibits a recurrent spiking behavior with period equal to the SortinoPeriod (SP) parameter (which, by the way, if you are mathematically inclined you will find it is perfectly normal and expected). You may for example encounter cases where the raw Sortino indicator for a bar is, say, 3 and in the very next bar it flies to 100. The smooth Sortino indicator addresses this problem by taking the moving average of the numerator of the raw Sortino and dividing it by the moving average of its denominator. Both the moving averages are simple and their period is SP.
  • 05. RRR
    This is the Required Rate of Return for the Sortino indicator. Its default value is zero.

In the following figure the trading strategy “Accelerator” is applied to the Adidas stock. The blue line is the Sortino Ratio Indicator.


The Sortino Ratio Indicator shows how the Sortino Ratio evolves along with the system’s performance over time. In this example the SortinoPeriod has the default value of 21 and the chart is daily which means that we calculate the monthly Sortino. The bottom sub chart is the plot of Sortino Ratio Indicator.


The Sortino Ratio Indicator can be set individually using the available inputs.


The Sortino Ratio Indicator of the corresponding security can be seen in the performance report.

Of course you can calculate the Sortino Ratio for the equity curve of a strategy applied in a portfolio, but the SRI for the portfolio won‘t be plotted in a sub chart. The Sortino Ratio values shown in the portfolio sub window (column: Sortino Ratio Indicator) are the last values of the individual SRIs for the stocks in the same row (see figure 5a). In the performance statistics of the portfolio you can see the Sortino_Global which is the latest value of the SRI for the equity curve of the portfolio.


  • 01. The SRI is calculated when the equity curve of the strategy is always positive since it relies in percentage returns. If the equity takes a negative value at some bar then the calculation of SRI stops and the value of Global_Sortino becomes 0.0000.
  • 02. You will notice that even if you use the smoothed version of Sortino indicator you might get some very high (or n/a) initial values when the SortinoPeriod or PeriodsBack are very small. This is to be expected if the equity of the system is highly profitable in its first stages.


The numbers shown in the Sortino column of the portfolio window are the last values of the individual Sortino Ratios for the stocks.


In this example the last value of the Sortino Ratio Indicator (default parameters) applied in a portfolio of several DAX stocks is 0.243 as can be seen in the first line.

That’s it for today. Take care, take profit and “Eις το επανιδείν”.
Giorgos Siligardos


© Copyright Tradesignal Ltd., London.
Distribution allowed under a Creative Commons Attribution-Noncommercial license

Tradesignal® is a registered trademark of Tradesignal GmbH. Unauthorized use or misuse is specifically prohibited. All other protected brands and trademarks mentioned in this document conform, without restriction, to the provisions of applicable trademark law and the copyrights of the respective registered owners.

Tradesignal Ltd. obtains information from sources it considers reliable, but does not guarantee the accuracy or completeness of its information contained therein. Tradesignal Ltd. and its affiliates make no representation or warranty, either express or implied, with respect to the information or analysis supplied herein, including without limitation the implied warranties of fitness for a particular purpose and merchantability, and each specifically disclaims any such warranty. In no event shall Tradesignal Ltd. or its affiliates be liable to for any decision made or action taken in reliance upon the information contained herein, lost profits or any indirect, consequential, special or incidental damages, whether in contract, tort or otherwise, even if advised of the possibility of such damages. This material does not constitute an offer or a solicitation of an offer or a recommendation to buy or sell securities. All expressions of opinion are subject to change without notice.

This code is provided free of charge and “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of fitness for a particular purpose and noninfringement. In no event, shall Tradesignal Ltd. be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, or of or in connection with this code or the use of this code.


fringilla eleifend pulvinar id, ipsum Curabitur