With a constant riskless rate, the Sharpe ratio in trading is a strategy's average return above that rate, divided by the standard deviation of its returns over the same periods. It measures excess return per unit of variability: 0.5 means half a percentage point of excess return for each point of standard deviation. William F. Sharpe introduced it in 1966. Compare two values only when their return period, riskless rate and time scaling match, because TradingView and MetaTrader 5 calculate it differently.
This page belongs to the trading metrics library, which uses one set of formulas across every metric page. Worked examples here are illustrative. Automation executes a strategy's rules; it does not create an edge.

Sharpe ratio at a glance
- Definition, constant riskless rate: (mean period return − riskless rate) ÷ standard deviation of period returns.
- Originator: William F. Sharpe, who proposed it in 1966 as the "reward-to-variability ratio" and restated it in 1994.[1]
- Units: none, but the value belongs to its measurement period.
- Time scaling: multiply a period ratio by √(periods in one year), assuming uncorrelated excess returns with stable period means and variances, summed rather than compounded.
- Where to find it: the TradingView strategy report, the MT5 Strategy Tester report and the MT5 Trading Report. The published PineConnector Analytics guide does not list it.
- What it leaves out: whether variability is upside or downside, the order of returns, the shape of the return distribution (such as rare large losses) and correlation with other holdings.
What is the Sharpe ratio formula?
Sharpe ratio = (mean period return − riskless rate) ÷ standard deviation of period returns
- Mean period return is the average of the strategy's returns over equal periods, such as months, each as a percentage of account equity.
- Riskless rate is the return on a riskless asset over the same period length. Sharpe's original benchmark was a riskless security. His 1994 generalisation uses each period's return minus its benchmark return, in both the mean and standard deviation.[1] MetaQuotes lists bank deposits, bonds and other minimum-risk assets as the traditional choices.[4]
- Standard deviation measures how widely the period returns spread around their mean. The worked examples use population standard deviation, dividing squared deviations by N, the number of returns.
The formula above assumes a constant riskless rate across the measured periods. With a varying benchmark, first subtract its return in each period and compute both the mean and deviation of that differential series. A zero deviation leaves the ratio undefined. Sharpe's spreadsheet example uses Excel's STDEV, which Microsoft documents as dividing by N − 1.[3] Sharpe notes that using N preserves relative rankings when all funds have the same number of observations.[1] State the divisor: it affects the reported value, particularly on small samples.
Subtracting the riskless rate can change a ranking. Sharpe's own example compares fund X, expecting 5% with a 10% standard deviation, and fund Y, expecting 8% with 20%, when the riskless rate is 3%.[1]
- Return ÷ deviation: X scores 5 ÷ 10 = 0.50 and Y scores 8 ÷ 20 = 0.40, so X looks stronger.
- Sharpe ratio: X scores (5 − 3) ÷ 10 = 0.20 and Y scores (8 − 3) ÷ 20 = 0.25, so Y ranks first.
- Same risk, compared directly: half in Y and half in the riskless asset has a 10% deviation, like X, and expects 5.5% against X's 5.0%.
The mix still scores (5.5 − 3) ÷ 10 = 0.25. In this frictionless example, a positive scaling of excess returns scales their deviation equally. Costs, borrowing rates and nonlinear exposure can break that relationship.
How do you convert a monthly Sharpe ratio to one year?
One-year Sharpe ratio = period Sharpe ratio × √(periods in one year)
With stable period means and variances and no serial correlation, summing T periods multiplies expected excess return by T and deviation by √T, so the ratio grows with √T. Sharpe derives this for summed one-period returns without serial correlation.[1] The common factors are:
- Monthly: √12 ≈ 3.46.
- Weekly: √52 ≈ 7.21.
- Daily, 252 trading days: √252 ≈ 15.87. MetaQuotes uses 252 working days in its own worked conversion.[4]
Sharpe recommends short measurement periods, such as months, before annualising.[1] Compounding and serial correlation complicate that conversion. Andrew W. Lo showed in 2002 that multiplying a monthly ratio by √12 is correct only under very special circumstances. In his hedge-fund example, serial correlation in monthly returns could overstate the one-year ratio by as much as 65%.[5]
With sample standard deviation (dividing by T − 1), the usual t-statistic of the mean differential return equals the Sharpe ratio times √T. That identity does not apply unchanged to this page's population-deviation examples.[1] The System Quality Number applies the same construction to R-multiples.
Worked example: a Sharpe ratio from 12 monthly returns
Illustrative example, not a recommendation. An account records these 12 monthly returns, in percent of equity, after assumed trading costs and adjusted for external cash flows: +3, −1, +1, +5, 0, +2, −3, +1, 0, +3, +1 and 0. The riskless rate is 2.4% a year, converted by simple division to 0.2% a month.
- Mean: the returns sum to 12, so the mean is 12 ÷ 12 = 1.0% a month.
- Excess return: 1.0 − 0.2 = 0.8% a month.
- Standard deviation: the deviations from 1.0 are +2, −2, 0, +4, −1, +1, −4, 0, −1, +2, 0 and −1. Their squares sum to 48, so the variance is 48 ÷ 12 = 4 and the standard deviation is √4 = 2.0%.
- Monthly Sharpe ratio: 0.8 ÷ 2.0 = 0.40.
- One-year basis: 0.40 × √12 = 0.40 × 3.464 ≈ 1.39, under the summing and stable-period assumptions above.
A cross-check scales each part separately. The excess return becomes 0.8 × 12 = 9.6%, and the deviation becomes 2.0 × √12 ≈ 6.93%. Then 9.6 ÷ 6.93 ≈ 1.39 again.

The same 12 returns give different answers under other conventions:
- Zero riskless rate, as in the MT5 Strategy Tester: 1.0 ÷ 2.0 = 0.50 a month, or 0.50 × 3.464 ≈ 1.73 on a one-year basis.
- Dividing by N − 1: the deviation becomes √(48 ÷ 11) ≈ 2.09%, so the monthly ratio is 0.8 ÷ 2.09 ≈ 0.38, or about 1.33 on a one-year basis.
- Compounding instead of summing: the 12 months compound to about 12.42% rather than 12.0%. Converting 2.4% to a monthly rate by compounding gives about 0.198% rather than 0.2%.
Reading a monthly 0.40 against a one-year band, or comparing 1.73 with 1.33, compares conventions, not strategies.
What is a good Sharpe ratio?
There is no universal good Sharpe ratio. The value depends on the return period, riskless rate, time scaling, sample and market. These commonly cited reference points each have limits.
- Below 0: the mean return fell short of the riskless rate. MetaQuotes' MetaTrader 5 help labels this "Bad".[6]
- MetaQuotes' bands: between 0 and 1.0, "the risk does not pay off"; 1.0 and above, "Good"; 3.0 and above, "Very good".[6] MetaQuotes' 2022 article says converting the ratio to a one-year value is what enables this classic reading.[4]
- MT5 optimisation colours: the optimisation results table shades Sharpe values from green above 2 to red below 0, and offers a filter that hides passes below 0.5.[7] These are display settings, not tests of significance.
- Sharpe's stock-market illustration: illustrative estimates in 1994 for a developed-market index might include a 6% mean excess return and a 15% standard deviation, both over one year. That gives 6 ÷ 15 = 0.40.[1] The figure illustrates scale; it is not a target.
- A very large backtest value is a reason to check. MT5's genetic optimisation can rank passes by "Sharpe Ratio max".[8] The best of many passes selects luck as well as rules; see overfitting and curve fitting.
Every Sharpe ratio is an estimate. Lo notes that expected returns and volatility must themselves be estimated.[5] A test covering 12 complete months supplies just 12 full monthly observations; partial endpoint months need separate treatment. Read how many trades a backtest needs before trusting a small sample.
How do TradingView and MT5 calculate the Sharpe ratio?
TradingView strategy report
As of 25 September 2026, TradingView calls its backtest panel the strategy report. Its July 2026 release notes describe that interface as "formerly known as the Strategy Tester".[9] The Sharpe ratio appears on the Risk-adjusted performance tab of Return details, beside the Sortino ratio, measured against the riskless rate set in the strategy() declaration. The Overview sub-tab also shows it above its graphs.[10]
TradingView's Help Center describes monthly returns, a riskless rate and standard deviation as the inputs.[2]
- MR is average monthly return. A month in which equity grows from 100 to 110 is a 10% return.
-
RFR defaults to 2% a year and is set with the
risk_free_rateparameter ofstrategy(). - SD measures variability on both sides of the mean. Check the platform's deviation and annualisation conventions before trying to reproduce its value.
Since August 2024, both the Sharpe and Sortino ratios always use monthly periods. Before that, test ranges of three days to three months used daily periods.[9] The help page gives the riskless rate for a whole year and the returns by month, but does not say how the two are matched or whether the result is scaled to one year. A copy of the strategy with risk_free_rate set to 0 isolates that input. The TradingView strategy report guide covers the neighbouring metrics.
MetaTrader 5 Strategy Tester
The MT5 Strategy Tester runs Expert Advisors on history data.[11] Its Testing Report defines the Sharpe ratio as return minus the riskless rate, divided by the standard deviation of return, and sets the riskless rate to zero in the tester.[6]
MetaQuotes' March 2022 article describes the calculation in more detail. It takes equity on the last tick of each bar, keeps only bars where equity changed, and uses log returns with a deviation that divides by N. The article explains annual scaling using 252 trading days for daily and shorter bars and reports that its custom criterion matched tester values in its example.[4] The help page does not restate these details; this describes the published 2022 method, not a test of the current terminal build. The MT5 Strategy Tester report guide explains the other fields.
MetaTrader 5 Trading Report
For a live or demo account, the Trading Report opens from Reports in the View menu and is built from the account's trading history. MetaQuotes describes a ratio using mean profit for the position holding time and its standard deviation.[12] It also includes a riskless rate, described as bank-deposit interest.
PineConnector Analytics
The PineConnector Analytics guide lists net profit, drawdown, profit factor, win rate, reward-to-risk and expectancy. It does not list a Sharpe ratio. Analytics needs PineConnector MT5 EA v3.41 or later and, in the published guide, is not available for MT4.[13]
How does the Sharpe ratio carry from a TradingView alert to an MT5 order?
A PineConnector workflow runs from an idea to a measurable rule, a TradingView alert and an MT5 order. Each Sharpe ratio along that path describes a different return series.
-
TradingView strategy report: monthly returns of simulated equity, on TradingView's data, against the riskless rate in
strategy(). - MT5 Trading Report: executed deals on the account at the broker's prices. Its Profit/Loss tab separates manual, algorithmic and copy trading, so the account record can include trades the alert never sent.[12]
- MT5 Strategy Tester: relevant only if you test an Expert Advisor version of the rules on MT5 history. That is a separate implementation with its own figure.
The stages in between are separate events: the alert condition becoming true, the alert triggering, webhook delivery, PineConnector processing the signal, the EA's order request, and broker acceptance, the deal and the position. A missed entry can leave a simulated trade absent from the account. A missed exit can leave a broker position open after its simulated counterpart closes. TradingView and MetaTrader can also use different data feeds, bid/ask quotes, spreads and timestamps.[14]
To compare executed results with the backtest, compute both ratios the same way: month-end equity, deposits and withdrawals left out of the returns, and a stated riskless rate and scaling. Why TradingView and MT5 results differ lists the usual causes of a gap.

What does the Sharpe ratio miss?
It counts upside variability as risk. TradingView's standard deviation includes gains as well as losses.[2] Replace April's +5% in the worked example with +29%. The mean rises to 3.0% and the deviation to 8.0%, so the ratio falls to (3.0 − 0.2) ÷ 8.0 = 0.35 from 0.40. The losing months are unchanged, so downside deviation below a 0% target stays at √(10 ÷ 12) ≈ 0.91%.

The Sortino ratio divides by downside deviation instead, so gains above its target do not increase that denominator.[15] With a 0% target, it moves from 1.0 ÷ 0.913 ≈ 1.10 to 3.0 ÷ 0.913 ≈ 3.29.
- The order of returns. Reorder the worked example as +3, +1, +5, 0, +2, −3, −1, +1, 0, +3, +1, 0. The mean and deviation are unchanged, so the ratio is still 0.40. The largest compounded fall from a peak grows from 3.00% to 1 − (0.97 × 0.99) = 3.97%. Read maximum drawdown and the Calmar ratio alongside it.
- Rare large losses. MetaQuotes warns about interpreting the ratio when returns are not normally distributed. Normality is not required to calculate the number; the limitation is using mean and deviation as a complete account of risk.[4] A short sample can look calm simply because the rare loss has not happened yet.
- Correlation with everything else. Sharpe explains that the ratio alone omits correlation with other holdings, liabilities and earlier returns.[1]
- Size of the swings. Under proportional scaling of excess returns, the same Sharpe ratio can sit on small or large swings in account currency.
Frequently asked questions
What is the Sharpe ratio in trading?
The Sharpe ratio in trading is the mean difference between a strategy’s period returns and the matching benchmark returns, divided by the standard deviation of those differences. With a constant riskless benchmark rate, that deviation equals the deviation of strategy returns. It expresses excess return per unit of variability. William F. Sharpe introduced it in 1966. Two values are comparable only when they use the same return period, riskless rate and time scaling.
What is the Sharpe ratio formula?
For a constant period riskless rate, the Sharpe ratio formula is (mean period return − riskless rate) ÷ standard deviation of period returns. If the deviation is zero, the ratio is undefined. For example, a mean monthly return of 1.0%, a riskless rate of 0.2% a month and a standard deviation of 2.0% give 0.8 ÷ 2.0 = 0.40 for one month. Multiplying by √12 gives about 1.39 on a one-year basis, under stable, uncorrelated period returns and additive scaling.
What is a good Sharpe ratio?
There is no universal good Sharpe ratio. MetaQuotes' MetaTrader 5 help labels values below 0 as bad, 1.0 and above as good and 3.0 and above as very good, and MetaQuotes applies that reading to ratios scaled to one year. Those bands are conventions, not statistical tests. Check the sample size, costs and optimisation history behind any large value.
Why do TradingView and MT5 show different Sharpe ratios?
TradingView's strategy report uses monthly returns and a default riskless rate of 2% a year. MetaTrader 5's Strategy Tester sets the riskless rate to zero and, per MetaQuotes' 2022 article, computes the ratio from per-bar equity returns and scales it to one year. MT5's Trading Report uses the mean profit for the position holding time. Different inputs give different numbers for similar trades.
How do you convert a monthly Sharpe ratio to one year?
To convert a monthly Sharpe ratio to one year, multiply it by the square root of 12, about 3.46. A daily ratio on 252 trading days is multiplied by √252, about 15.87. The rule assumes stable period means and variances, no serial correlation, and summed rather than compounded excess returns. Andrew Lo showed that serial correlation can overstate the scaled figure, by as much as 65% in one hedge-fund example.
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
- Trading metrics library: every formula in one place
- Sortino ratio: return per unit of downside deviation
- Calmar ratio: return relative to maximum drawdown
- Maximum drawdown: how to measure the worst fall
- System Quality Number: a t-statistic of R-multiples
Sources
- William F. Sharpe – The Sharpe Ratio (Journal of Portfolio Management, Fall 1994), accessed 25 September 2026.
- TradingView – Sharpe Ratio, accessed 25 September 2026.
- Microsoft – STDEV function, accessed 25 September 2026.
- MetaQuotes – Mathematics in trading: Sharpe and Sortino ratios (MQL5 article, 31 March 2022), accessed 25 September 2026.
- Andrew W. Lo – The Statistics of Sharpe Ratios (Financial Analysts Journal, July 2002), accessed 25 September 2026.
- MetaQuotes – MetaTrader 5 Help: Testing Report, accessed 25 September 2026.
- MetaQuotes – MetaTrader 5 Help: Strategy optimization, accessed 25 September 2026.
- MetaQuotes – MetaTrader 5 Help: Optimization types, accessed 25 September 2026.
- TradingView – Pine Script release notes, accessed 25 September 2026.
- TradingView – Pine Script User Manual: Strategies, accessed 25 September 2026.
- MetaQuotes – MetaTrader 5 Help: Strategy Tester, accessed 25 September 2026.
- MetaQuotes – MetaTrader 5 Help: Trading Report, accessed 25 September 2026.
- PineConnector – Trading analytics, accessed 25 September 2026.
- PineConnector – Frequently asked questions: price differences, accessed 25 September 2026.
- TradingView – Sortino Ratio, 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.