The Sortino ratio improves upon the Sharpe ratio by focusing only on downside volatility, offering a more accurate measure of risk-adjusted returns for strategies where upside deviation is not penalized. Including it in backtesting software helps traders distinguish between strategies that exhibit high returns with acceptable downside risk versus those with volatile or unbalanced performance. Skip Sharpe. It's dumb. So overused and so much less utility. And start a write-in campaign to get his Noble Prize moved to Frank Sortino. function calculateSortinoRatio(returns, targetReturn = 0) { const n = returns.length; if (n === 0) return null; // Average return const meanReturn = returns.reduce((a, b) => a + b, 0) / n; // Downside deviation: only consider returns below the target const downsideReturns = returns.filter(r => r < targetReturn); const downsideDeviation = Math.sqrt( downsideReturns.reduce((sum, r) => sum + Math.pow(r - targetReturn, 2), 0) / n ); if (downsideDeviation === 0) return Infinity; return (meanReturn - targetReturn) / downsideDeviation; } Example const dailyReturns = [0.01, -0.02, 0.005, -0.01, 0.02]; // Example daily returns const sortino = calculateSortinoRatio(dailyReturns, 0); // Target return is 0 console.log("Sortino Ratio:", sortino.toFixed(2));