Sharp Ratio or/and Sortino Ratio

 

Can anybody from MT4 developers or experienced guys publish formulas/methods for Sharp Ratio calculations used in new reports on Championship website.

I am interested in Sortino Ratio calculations as well

Does anybody know how ...

Please

 
On MQL4 function

//+------------------------------------------------------------------+
//| вычисляет на основании массива значений Баланса                  |
//+------------------------------------------------------------------+
// RiskFreeRate в абсолютных величинах, если безрисоквая ставка равна 2%, то нужно передавать 0.02
double GetSharpFromArray(double & AHPR, double BalanceArray[],double RiskFreeRate=0,bool direct=true)
   {
   double res,Std;
//----
   int i,limit=ArraySize(BalanceArray);
   if (limit<2) 
      {
      Print("Мало данных для функции GetSharpFromArray!!!!");
      return(0);
      }
   double HPR[];
   int N=limit-1;
   ArrayResize(HPR,limit-1);   
   if (direct)
      {
      for (i=1;i<limit;i++)
         {
         if (BalanceArray[i-1]!=0) 
            {
            HPR[i-1]=BalanceArray[i]/BalanceArray[i-1];
            AHPR+=HPR[i-1];
            //Print("i=",i-1,"  Balance[",i,"]=",BalanceArray[i-1],"   HPR[",i,"]=",HPR[i-1]);
            }
         }
      }
   else
      {
      for (i=limit-2;i>=0;i--)
         {
         if (BalanceArray[i+1]!=0) 
            {
            HPR[i]=BalanceArray[i]/BalanceArray[i+1];
            AHPR+=HPR[i];
            //Print("i=",i,"  Balance[",i,"]=",BalanceArray[i],"   HPR[",i,"]=",HPR[i]);
            }
         }
      }
   AHPR=AHPR/(N);
   
   for (i=0;i<N-1;i++)
      {
      Std+=(AHPR-HPR[i])*(AHPR-HPR[i]);
      }
   Std=MathPow(Std/(N-1),0.5);
   res=(AHPR-(1.0+RiskFreeRate))/Std;
//----
   return(res);
   }
 

Thank you very much Rosh,

How about Sortino Ratio ?

Sortino is known as more realistic measure of risk-adjusted returns than the Sharpe

and it is penalizes only downside returns while the Sharpe ratio penalizes both upside and downside volatility equally .

 
The Sortino Ratio is a variate of the Sharpe Ratio. You should be able to adapt the Sortino Ratio spreadsheet here to modify the code above to calculate the Sortino Ratio
 
The Sortino Ratio Excel spreadsheet is now here
 
What is the mean of the function argument AHPR?


Rosh:
On MQL4 function