Skip to content

Trading metrics

Sortino Ratio: Formula, Downside Deviation and Sortino vs Sharpe

The Sortino ratio is the average return in excess of a target, divided by downside deviation: the root-mean-square of each period's shortfall below that target. Periods at or above the target count as a shortfall of zero, so large gains do not enlarge the risk figure the way they enlarge standard deviation in the Sharpe ratio. The value depends on the target, the return period and the downside-deviation convention, so compare Sortino ratios only when these conventions and any annual scaling match.

This page is part of the trading metrics library, which uses one set of formulas across every metric. All numbers are illustrative. Automation executes a strategy's rules; it does not create an edge.

Illustrative cover for the Sortino ratio: monthly return bars around a target line, with only the below-target months shaded as downside, and the official PineConnector logo.
The Sortino ratio counts only the shortfalls below a target as risk.

Sortino ratio at a glance

  • Definition: (mean period return − target) ÷ downside deviation.
  • Downside deviation: the square root of the average squared shortfall below the target, averaged over all periods.
  • Target: a return the investor requires, also called the minimum acceptable return (MAR). Zero and a riskless rate are common choices.[1]
  • Named after: Frank Sortino of the Pension Research Institute.[2]
  • How to read it: with a positive numerator and matching conventions, a larger value means more excess return per unit of downside deviation. Below zero, the mean return missed the target.
  • Where to find it: TradingView's strategy report. As of 25 September 2026, MetaQuotes' help for the MetaTrader 5 tester and account reports lists a Sharpe ratio but no Sortino ratio.

What is the Sortino ratio formula?

Sortino ratio = (mean period return − target) ÷ downside deviation

Downside deviation = √[ (1 ÷ n) × Σ min(0, ri − target)² ]

  • Mean period return is the average of the n period returns, for example monthly.
  • Target is the required return. In Sortino's early work it was the minimum acceptable return, or MAR.[3] The CFA Institute article lists an absolute return, an index return, a riskless rate or zero as possible targets.[2]
  • min(0, ri − target) is the shortfall in period i. A period at or above the target gives zero.
  • n is the positive number of all periods, including the ones at or above the target. With no observations or zero downside deviation, the ratio is undefined.

This page uses the all-periods convention. Red Rock Capital's explanation of the ratio says above-target returns contribute zero shortfall while remaining in the count.[3] TradingView's Help Center defines N as the total number of returns, but its calculation details should be checked before treating this example as a reproduction of its output.[4] The LuxAlgo Library also describes dividing by all periods as the common convention.[1]

Worked example: the Sortino ratio from 12 monthly returns

Illustrative example, not a recommendation. Series A has 12 monthly returns, in percent, after assumed trading costs and adjusted for external cash flows: +6, 0, −2, 0, 0, +6, −2, 0, 0, −2, +6, 0. The target is 0% and no riskless rate is subtracted, to keep the arithmetic visible.

  1. Mean monthly return: (3 × 6 + 6 × 0 + 3 × (−2)) ÷ 12 = (18 − 6) ÷ 12 = 1.0%.
  2. Excess over the target: 1.0 − 0 = 1.0 percentage point.
  3. Shortfalls: each of the three −2% months gives −2. The nine other months give 0.
  4. Squared shortfalls: 3 × (−2)² = 3 × 4 = 12. The nine zeros add nothing but stay in the count.
  5. Average over all 12 months: 12 ÷ 12 = 1. Downside deviation: √1 = 1.0%.
  6. Sortino ratio: 1.0 ÷ 1.0 = 1.00, on a monthly basis.
Illustrative diagram of downside deviation for 12 monthly returns with a 0% target: three months at minus 2% give squared shortfalls of 12; dividing by all 12 months gives 1.0% and a Sortino ratio of 1.00, dividing by the 3 losing months gives 2.0% and 0.50.
Illustrative Series A, target 0%. Months at or above the target stay in the count as zero shortfalls. Dropping them halves this Sortino ratio.

Which conventions change the answer?

Other conventions give different results from the same 12 months:

  • Dividing by the losing months only: 12 ÷ 3 = 4 and √4 = 2.0%, so the ratio halves to 0.50. The CFA Institute article warns against substituting the below-target count for the total count.[2]
  • Standard deviation of the losing months: all three are −2%, so their standard deviation is 0 and the ratio is undefined. Red Rock Capital says it most often sees this method and shows why it fails: four returns of −10 have a standard deviation of 0 but a target downside deviation of 10.[3]
  • Zeroing the gains, then taking a standard deviation: MetaQuotes' 2022 MQL5 article uses this method, which measures spread around the new series' own mean.[5] Using this page's population divisor, nine 0s and three −2s have a mean of −0.5. The squared deviations total 9 × 0.25 + 3 × 2.25 = 9, and √(9 ÷ 12) ≈ 0.87%, so the ratio is about 1.15.
  • A 1% target, or semideviation: semideviation measures shortfalls below the mean, which is 1.0% here.[2] Each 0% month becomes a shortfall of −1 and each −2% month one of −3, so (6 × 1 + 3 × 9) ÷ 12 = 2.75 and √2.75 ≈ 1.66%. With a 1% target the excess return is 0, so the ratio is 0.00.
  • Subtracting a riskless rate: Some versions use a riskless rate instead of a personal return target. The CFA Institute article notes that Sortino and Price (1994) regarded this as less useful for judging whether an investor met a particular goal.[2]

Sortino vs Sharpe: what is the difference?

The Sharpe ratio, which William F. Sharpe introduced in 1966 as the "reward-to-variability ratio", uses the average return above a constant riskless rate divided by the standard deviation of returns.[6] TradingView notes that its Sharpe denominator "includes both upside and downside volatility".[7] The Sortino ratio keeps the excess-return numerator and divides by downside deviation, so only shortfalls below the target count as risk. See the Sharpe ratio guide for its own conventions.

Illustrative: Series B flips Series A around its 1.0% mean. It has three months at −4%, six at +2% and three at +4%, so its mean is (−12 + 12 + 12) ÷ 12 = 1.0%.

  • Standard deviation, both series: Series A deviates from its mean by +5 three times, −1 six times and −3 three times. The squares total 75 + 6 + 27 = 108, and √(108 ÷ 12) = 3.0%. Series B has the same deviations with signs reversed.
  • Sharpe ratio, both series: 1.0 ÷ 3.0 ≈ 0.33.
  • Downside deviation: Series A is 1.0%, from the worked example. Series B gives 3 × (−4)² = 48, 48 ÷ 12 = 4 and √4 = 2.0%.
  • Sortino ratio: Series A is 1.0 ÷ 1.0 = 1.00. Series B is 1.0 ÷ 2.0 = 0.50.
Illustrative diagram comparing two 12-month return series with the same 1.0% mean and 3.0% standard deviation: both have a Sharpe ratio of 0.33, but Series A has a Sortino ratio of 1.00 and Series B, with deeper losing months, 0.50.
Illustrative, monthly basis, 0% target and riskless rate. Standard deviation cannot tell the two series apart; downside deviation can.

Reading the two ratios together tells you more than either alone. The CFA Institute article explains that comparing them helps distinguish upside variability from downside variability. With normally distributed returns and a target equal to the riskless rate, the two rank portfolios the same way.[2]

The two numbers are not on the same scale. When the target equals the riskless rate and sits at or below the mean return, downside deviation cannot exceed standard deviation. With both denominators positive, the Sortino ratio is then at least as large as the Sharpe ratio for the same returns, so a Sortino figure above a Sharpe figure says nothing on its own.

What is a good Sortino ratio?

There is no universal good Sortino ratio. The value moves with the target, the return period, the downside-deviation convention and how many below-target periods the sample contains. These commonly cited reference points each have limits.

  • Below 0 means the mean return missed the target. Charles Schwab reads a negative value as a return below either the riskless rate or the MAR.[8] That is arithmetic, not a judgement of quality.
  • Schwab's guideline ranges are written for funds. Schwab's guide calls 0.00 to 1.00 "suboptimal" and says "Above 1.00 is considered good", with values above 2.00 very good and above 3.00 excellent.[8] Its example uses a 12-month fund return. Schwab warns that less than three years of history can weaken the calculation; that is its fund-analysis guidance, and it does not establish that a longer sample is sufficient.[8]
  • Very high backtested values are a reason to check. The LuxAlgo Library says values above roughly 1, on live returns scaled to a year, are commonly considered solid. It treats unusually high backtest values as a reason to investigate overfitting.[1] See overfitting and curve fitting.

The return period decides which band a figure falls into. TradingView's Help Center text lists monthly returns but does not explain annual scaling.[4] A common shortcut multiplies a monthly ratio by √12. The CFA Institute article quotes an analyst who says analytical packages scale downside deviation this way, and questions whether that operation represents downside risk over a year.[2] Applying the shortcut mechanically turns Series A's 1.00 into about 3.46. That arithmetic does not establish its actual downside risk over a year or make the fund bands applicable. Match the period, target and convention before comparing any figure with a reference point.

Sample size matters too. Series A's downside deviation rests on 3 losing months out of 12, and LuxAlgo warns that estimates based on sparse below-target periods can be unstable.[1] See how many trades a backtest needs.

Where do TradingView and MT5 show the Sortino ratio?

TradingView strategy report

As of 25 September 2026, TradingView's Pine Script manual places Sharpe and Sortino ratios under Metrics → Return details → Risk-adjusted performance.[9] The Help Center defines the inputs:[4]

  • MR: average monthly return. Its worked example measures a month's return from account equity: 100 on 1 January and 110 on 1 February give 10%.
  • RFR: a riskless rate of 2% a year by default, set by the risk_free_rate parameter of strategy(). The page does not say how it is matched to monthly returns.
  • DD: downside deviation. The accompanying text defines N as total returns and T as the target return, but does not state T's value.

TradingView's release notes say the risk_free_rate parameter, added in April 2022, is used for both ratios. Before the August 2024 calculation change, tests spanning at least three days but under three months used daily periods. Since August 2024, both ratios always use monthly periods.[10] A short test therefore gives few monthly returns, and fewer below-target months.

None of the strategy.* variables listed on the Strategies page is a Sortino value.[9] The TradingView strategy report guide covers the neighbouring metrics.

MetaTrader 5 Strategy Tester and Trading Report

As of 25 September 2026, MetaQuotes' help for the MT5 Strategy Tester report lists a Sharpe Ratio, with the riskless rate assumed to be zero, and no Sortino ratio.[11] The help for the account Trading Report also lists a Sharpe Ratio without a Sortino ratio.[12] MQL5's testing statistics include STAT_SHARPE_RATIO but no Sortino identifier, so a Sortino used as a tester optimization criterion would need custom calculation, for example through OnTester().[13] The MT5 Strategy Tester report guide covers the fields the tester does show.

For an account, the Trading Report shows balance or growth changes by month and year, and the report can be saved as HTML or PDF.[12] Those monthly figures are one input for a calculation of your own; adjust for deposits and withdrawals, and use consistent month-end values. State whether they are balance or equity: PineConnector's syntax guide notes that equity "includes floating profit or loss, so it can differ from balance".[14]

PineConnector Analytics

The published PineConnector Analytics guide lists net profit, drawdown, profit factor, win rate, reward-to-risk and expectancy for connected MT5 accounts, with MT5 EA v3.41 or later.[15] A Sortino ratio is not documented there, so check the Portal rather than assume one exists.

Why can an MT5 account's Sortino ratio differ from TradingView's?

A PineConnector workflow runs from an idea to a measurable rule, a TradingView alert and an MT5 order. The TradingView Sortino ratio describes simulated monthly equity. The executed account's months come from the deals your broker filled, with separate stages in between:

  1. the alert condition becoming true, and the alert triggering;
  2. webhook delivery;
  3. PineConnector processing the signal;
  4. the EA's order request;
  5. broker acceptance, the deal and the resulting position.

A missed entry can remove a trade from the broker record; a missed exit can leave a position open. Either can change the executed months without changing the simulation. Prices differ too: TradingView and MetaTrader can use different data feeds, bid/ask quotes, spreads and timestamps.[16] Exits shape the losing months, and a stop that exists only in the Pine strategy is not a broker-side stop loss. The EA's Setting input decides whether stop loss, take profit and risk "come from your alert, the EA inputs, or a mix".[17]

To compare the two figures, build both return series the same way: the same months, the same equity or balance basis, the same target and the same convention. Treat a gap as something to explain. Why TradingView and MT5 results differ lists the usual causes.

What does the Sortino ratio not tell you?

  • How deep or long the worst drawdown was. The ratio uses each period's shortfall, not the path of equity. Illustrative, compounding monthly: placed back to back after a peak, Series A's three −2% months fall 1 − 0.98³ ≈ 5.9%. Ordered +6, −2, +6, −2, +6, −2 and then six 0% months, no fall exceeds 2%. Both orders have a Sortino ratio of 1.00. Read maximum drawdown or the Calmar ratio alongside it.
  • Risk that has not shown up yet. The CFA Institute article warns that predominantly positive samples can understate downside risk. An absent bad event is not proof of an absent risk.[2] Red Rock Capital adds that neither the Sortino nor the Sharpe ratio measures ongoing and future risks; both describe a past return stream.[3]
  • Anything, when no period falls below the target. Downside deviation is then zero and the ratio is undefined. Read that as a missing measurement, not an excellent result.
  • A fair comparison across targets. The CFA Institute article requires matching targets when comparing funds.[2]

Frequently asked questions

What is a good Sortino ratio?

No single Sortino ratio is good for every strategy, because the value depends on the target, the return period and the downside-deviation convention. Charles Schwab's fund guide, whose example uses 12-month fund returns, calls above 1.00 good, above 2.00 very good and above 3.00 excellent. A monthly TradingView figure is not directly comparable, and a very high backtested value can reflect overfitting.

What is the Sortino ratio formula?

The Sortino ratio formula is (mean period return − target) ÷ downside deviation. Downside deviation is the square root of the average squared shortfall below the target over all periods, counting periods at or above the target as zero. Twelve monthly returns with a 1.0% mean, whose only months below a 0% target are three at −2%, give 1.0 ÷ 1.0 = 1.00.

What is the difference between the Sortino and Sharpe ratio?

With a constant riskless rate, the Sharpe ratio divides average excess return by the standard deviation of all returns, so large gains contribute to variability. The Sortino ratio divides by downside deviation, which measures only shortfalls below a target. With that same riskless rate, two return series with the same mean and standard deviation share one Sharpe ratio. With the same nonzero excess return, different positive downside deviations produce different Sortino ratios. If excess return is zero, both defined ratios are zero.

How do you calculate downside deviation?

To calculate downside deviation, subtract the target from each period return, replace every positive result with zero, square the results, average them over all periods and take the square root. With a 0% target and 12 months whose only below-target months are three at −2%, the squares total 12, the average is 1 and downside deviation is 1.0%.

Can the Sortino ratio be negative?

Yes. The Sortino ratio is negative when the mean period return is below the target used in its numerator. A version using a riskless-rate benchmark instead turns negative below that benchmark. The ratio is undefined when no period falls below the target, because downside deviation is then zero. An undefined value is a missing measurement, not an excellent result.

Reviewed 25 September 2026. Facts were checked against the linked sources on that date. Nothing in this article was tested on a trading account and no code was compiled.

Related reading

Sources

  1. LuxAlgo – Sortino Ratio (LuxAlgo Library), accessed 25 September 2026.
  2. CFA Institute – The Sortino Ratio: Is Downside Risk the Only Risk that Matters? (Deborah Kidd, CFA, 2012), accessed 25 September 2026.
  3. Red Rock Capital – Sortino: A ‘Sharper’ Ratio (Thomas N. Rollinger and Scott T. Hoffman), accessed 25 September 2026.
  4. TradingView – Sortino Ratio, accessed 25 September 2026.
  5. MetaQuotes – Mathematics in trading: Sharpe and Sortino ratios (MQL5 article, 31 March 2022), accessed 25 September 2026.
  6. William F. Sharpe – The Sharpe Ratio (Journal of Portfolio Management, 1994), accessed 25 September 2026.
  7. TradingView – Sharpe Ratio, accessed 25 September 2026.
  8. Charles Schwab – Using the Sortino Ratio to Gauge Downside Risk, accessed 25 September 2026.
  9. TradingView – Pine Script User Manual: Strategies, accessed 25 September 2026.
  10. TradingView – Pine Script release notes, accessed 25 September 2026.
  11. MetaQuotes – MetaTrader 5 Help: Testing Report, accessed 25 September 2026.
  12. MetaQuotes – MetaTrader 5 Help: Trading Report, accessed 25 September 2026.
  13. MetaQuotes – MQL5 Reference: Testing Statistics, accessed 25 September 2026.
  14. PineConnector – Alert syntax: vol_pct_eq_loss=, accessed 25 September 2026.
  15. PineConnector – Trading analytics: read the performance metrics, accessed 25 September 2026.
  16. PineConnector – Frequently asked questions: price differences, accessed 25 September 2026.
  17. PineConnector – EA settings reference: signal or EA inputs, accessed 25 September 2026.

PineConnector executes the instructions you send it. It does not select trades, manage money, or hold funds. Trading carries risk, and past performance of any strategy does not indicate future results.


Leave a comment

Back To PiCo Blog

Ready when your strategy is

You bring the strategy.We bring the infrastructure.

Connect TradingView to MetaTrader, choose where MT5 runs and put the full PineConnector workflow through its paces from your first month.

Strategy and trading decisions remain yours. The MT5 environment can be ours.

PineConnector Edge

Run the full PineConnector workflow.

$59/mo at launch

Core plan · 1 connection · 1 hosted MT5 environment

Try Core for $7

7 days of Core for $7, then $59/month at the launch price unless you cancel.