File Exchange

image thumbnail

Sortino Ratio

version (1.29 KB) by Lorenzo Brancali
This file calculates the Sortino ratio of an investment asset, portfolio or strategy.


Updated 12 Mar 2012

View License

The Sortino ratio measures the risk-adjusted return of an investment asset, portfolio or strategy. It is a modification of the Sharpe ratio but penalizes only those returns falling below a user-specified target. The Sortino ratio is similar to the Sharpe ratio, except it uses downside deviation for the denominator instead of standard deviation, the use of which doesn't discriminate between upside and downside volatility.

Cite As

Lorenzo Brancali (2021). Sortino Ratio (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (6)

Christian Dandre

The code should be re-written as follows:

for j=1:size(R,2)




Gioia Gianmarco

Yair Altman

DD = sqrt( sum((F3-MAR).^2) / length(F) )

argh with the editor here... :-)

Yair Altman

Minor correction:

DD should be sqrt( sum(F3-MAR).^2 / length(F) )

i.e., divide by number of all returns, not just the number of downside returns.

Yair Altman

Incorrect calculation of the Downside Deviation (DD) and therefore of the Sortino ratio!

It should be sqrt( sum(F3-MAR).^2 / length(F3) ) and *NOT* sqrt(sum(F3).^2) / length(F3), where F3=nonzeros(F(F<MAR))

See for example

Harry Lindner

MATLAB Release Compatibility
Created with R2008a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!