Sortino Ratio
The Sortino ratio is a variation of the Sharpe ratio. Unlike the Sharpe ratio, it is calculated using the standard deviation of the downside risk, rather than that of the entire (upside + downside) risk. Due to this, it is thought to give a better view of a portfolio's risk-adjusted performance because positive volatility is considered a benefit.
The formula for the Sortino ratio is:

Where:
MR: Average return for a monthly period.
RFR: Risk-free rate of return (by default, 2% annually. Can be changed with the "risk_free_rate" parameter of the "strategy()" function).
DD: Downside deviation of returns.

(where Xi is the i-th return, N is the total number of returns, and T is the target return).
Example of Xi calculation:
January 1, 2026: Account equity = 100
February 1, 2026: Account equity = 110
January return (X1): (110 - 100) / 100 = 10%