TradingView backtesting metrics

TradingView Sharpe and Sortino ratios: compare the calculation first

TradingView already reports Sharpe and Sortino ratios. Its official definitions use monthly returns and an annual risk-free rate that defaults to 2%. Sharpe measures excess return against total return variability; Sortino uses downside deviation. Pineify's Backtest Deep Report analyzes trade-level CSV returns with a different calculation, so matching metric names do not imply matching values.

Open Backtest Deep Report

What the official Strategy Tester documentation defines

TradingView's Sharpe help page defines SR = (MR − RFR) / SD using monthly account-equity returns. Its Sortino page replaces SD with downside deviation. The annual benchmark is set by the risk_free_rate parameter in the strategy declaration. The official RiskMetrics library's update notes confirm monthly periods are used consistently; older descriptions of switching to daily returns on short histories should not be applied to the current calculation.

InputMeaningComparison check
Return observationAccount-equity change over a monthly periodDo not substitute each trade's P&L percentage.
Sharpe denominatorDispersion around the mean of all returnsCheck population versus sample standard deviation.
Sortino denominatorShortfalls below a target returnCheck the target and whether the divisor includes all observations.
Risk-free rateAnnual parameter; default 2%Use a rate in the same period and units as the returns.
AnnualizationThe published ratio formula has no square-root-of-12 multiplierLabel any additional annualization explicitly.

A reproducible monthly-return example

This synthetic arithmetic example uses four monthly account returns: 2%, −1%, 3%, −2%. Set both the risk-free rate and the downside target to zero. Use population standard deviation and divide downside squared shortfalls by all four months. These are illustrative inputs, not a measured TradingView strategy result. Using a zero benchmark removes rate-conversion ambiguity from the example.

  • The annualized row is a separate convention, not an assertion that TradingView displays those numbers. Square-root scaling assumes a return process for which variance scales with time; serial dependence can invalidate it.
  • For an independent spreadsheet check, use AVERAGE and STDEV.P for Sharpe. For Sortino, square min(return − target, 0) for every row, average those values, then take the square root.
  • For a nonzero benchmark, document the conversion. Simple monthly allocation of 2% is 2% / 12; an effective monthly rate is (1.02)^(1/12) − 1. These are different conventions.
CalculationWorkingResult
Mean monthly return(2 − 1 + 3 − 2) / 40.5%
Population standard deviationsqrt((1.5² + (−1.5)² + 2.5² + (−2.5)²) / 4)2.061553%
Monthly Sharpe0.5 / 2.0615530.242536
Downside deviation, target 0%sqrt((0² + (−1)² + 0² + (−2)²) / 4)1.118034%
Monthly Sortino0.5 / 1.1180340.447214
Optional conventional annualizationMultiply each monthly ratio by sqrt(12)Sharpe 0.840168; Sortino 1.549193

Why Pineify can report a different Sharpe or Sortino

The current Backtest Deep Report implementation reads the exported P&L percentage for each parsed trade. It uses population standard deviation and scales the trade ratio by sqrt(trades per year), measured from the first entry to the latest exit using 365.25 days per year. Its Sortino denominator uses the root mean square of negative trade returns only. This is a trade-distribution analysis, not a reproduction of TradingView's monthly account-equity statistics.

  • With the same four numerical returns treated as four trades spanning exactly one 365.25-day year, and risk-free input 0, Pineify's current formulas give annualized Sharpe 0.485071 and Sortino 0.632456. This is a calculation example, not an uploaded or live-tested report.
  • A rolling window, a direction filter or inclusion of open trades changes the sample. Record those choices before comparing results.
SettingPineify's current calculationEffect on comparison
Return seriesPer-trade P&L percentage from the CSV exit rowDifferent position sizes and overlapping trades do not become a monthly portfolio return series.
Risk-free inputDefaults to 0; the entered percentage is subtracted directly from the mean trade returnThere is no annual-to-trade conversion in this calculation. Entering TradingView's annual 2% does not reproduce its benchmark.
Downside divisorNumber of negative trade returns; target remains zeroDifferent from a downside formula that divides by all periods or uses a nonzero target.
Missing denominatorReturns 0 when the relevant deviation is zero; fewer than two trades also return 0Do not interpret these fallback values as evidence of zero risk or a valid risk-adjusted estimate.

Reconcile a trade CSV without losing the data boundaries

Export the Strategy Tester's List of Trades and open it in Backtest Deep Report. The parser expects trade identifiers and recognizable entry/exit types, pairs rows by trade ID, and reads P&L from the exit row. Keep timestamps and P&L percentage columns intact. A performance-summary export or a table of monthly equity values is a different input and should not be presented as a supported trade-list format.

  • Check parsed trade count, first entry, last exit, direction and open-position treatment against the original report. The current parser can default missing numeric fields to zero, so a successful import alone does not prove complete data.
  • For an independent monthly calculation, first obtain account equity at the same monthly boundaries, including the same treatment of unrealized P&L. Closed trade records alone do not reconstruct every equity observation.
  • Align initial capital, currency, sizing, commission, slippage and test dates. Keep a copy of the original export and record the formula convention beside the result.
  • Use the monthly spreadsheet calculation to reconcile monthly metrics. Use Pineify's report to inspect the parsed trade distribution; do not expect either calculation to substitute for the other.

Interpret the sample before interpreting the score

Four months are enough for the arithmetic above, but they provide little evidence about future performance. Hundreds of trades within those months do not create hundreds of independent monthly observations. Review the number of return periods, exposure, concentration of profits and losing periods before comparing strategies. There is no universal Sharpe or Sortino threshold that proves a strategy is ready for live trading.

  • One monthly observation has no observed dispersion. Constant returns give a zero Sharpe denominator; no returns below the target give a zero downside denominator. An undefined or extreme result needs investigation.
  • The linked Strategy Tester help pages do not specify a universal minimum trade count or all short-history display rules. Do not diagnose a blank ratio using an invented minimum such as 30 or 100 trades.
  • A strategy selected from many parameter trials can have an inflated historical ratio. Preserve untouched evaluation data and review drawdown, costs and concentration alongside the ratio.
  • Resampling past trades explores assumptions about that sample. It does not establish a genuine edge or guarantee that future market conditions will resemble it.
Where Pineify fits

Backtest Deep Report

Import a compatible TradingView List of Trades CSV to inspect trade returns, risk metrics and distributions. Review the parsed records and calculation boundaries above before comparing its ratios with Strategy Tester.

Open Backtest Deep Report

Frequently asked questions

Educational calculation guide, not investment advice. Examples use synthetic returns and are not measured strategy performance. Historical ratios and simulations do not guarantee future returns.

Sources and verification