The Sortino Ratio shows an adjusted measure of return by comparing the instrument price performance to a risk-free return. It is similar to the Sharpe Ratio except that only negative excess returns are taken into account. On this site we use the 13 week Treasury (IRX.X).
. first get the Monthly Change % for each of the months
. get the Monthly Closes for the 13 week treasury (IRX.X on Profitspi.com)
. prorate the annual IRX.X rates to monthly
. calculate the excess return over treasury for each month
. calculate the SMA(12) and SDV(n) of the excess negative n returns
. finally ratio = SMA / SDV * Sqrt(12)
Likewise for daily and weekly ratios we would adjust the treasury rates according to the period. And use sqrt of 252 and 52 respectively to annualize the final result.
The default setting is 200 daily bars but 36 monthly bars is also commonly used.