Discussion of article "Mathematics in trading: Sharpe and Sortino ratios"

 

New article Mathematics in trading: Sharpe and Sortino ratios has been published:

Return on investments is the most obvious indicator which investors and novice traders use for the analysis of trading efficiency. Professional traders use more reliable tools to analyze strategies, such as Sharpe and Sortino ratios, among others.

3D chart of the EURUSD annual Sharpe ratio for 2020 by month and timeframe

The diagram clearly shows that the values of the annual Sharpe ratio change every month. It depends on how EURUSD was changing this month. On the other hand, the annual Sharpe ratio for each month on all timeframes almost does not change.

Thus, the annual Sharpe Ratio can be calculated on any timeframe, while the resulting value also depends on the number of bars on which returns were obtained. It means that this calculation algorithm can be used in testing, optimization and monitoring in real time. The only prerequisite is to have a large enough array of returns.

Author: MetaQuotes

 
MetaQuotes:

New article Mathematics in trading: Sharpe and Sortino ratios has been published:

Author: MetaQuotes

In the semi-volatility calculation, I'm not sure that replacing positive value by zero is a correct approach. Did you try removing the element from array?
 

Try to checl it yourself.

See also sample in internet. For example - https://www.educba.com/sortino-ratio/

Sortino Ratio
Sortino Ratio
  • www.educba.com
The Sortino ratio is a kind of variation of Sharp ratio where it takes into consideration the harmful volatility and differentiates the same from the total overall volatility by measuring the risk-adjusted return of a portfolio of asset or investment portfolio, or a strategy, while it penalizes those returns falling lower from the user’s target...
 

The use of zero for Risk Free is not how it should be used.

As a minimum Risk Free is the return you would get from your capital if you placed it on deposit, bought treasuries etc.  ie: a risk free return for the capital. not stating a current value for this artificially increases the sharpe ratio

 
How can we use CalculateSortino_All_TF.mq5 to obtain the sortino ratio from the tester? It's a script but what are you supposed to do with it? Are you supposed to run it on the results you've obtained from optimization or does it get implemented within an EA somehow?
 


Due to the questions about the sharp ratio of signals that are quite successful but have a Sharp Ration of less than 1 I took one:

Expected Payoff: 54.58 USD,
Profit Factor: 3.27,
Monthly growth:28.80%,
Annual Forecast:349.40%)

=> but a sharp ratio of: Sharpe Ratio: 0.27

So I took the script of this article and modified it a bit so that it reads the trade history of a signal and calculates two kind of sharp ratios.
But instead of using timespans (year, month, day..) to calculate the returns for average and standard deviation I uses the single trades or positions.
I calculate two different returns:

  • one is just the profit divided by the closing volume to get a result per one lot and
  • the other one calculates (close-open)/open similar to the script that calculates with open and close of the bars of day and hour.

The functions for average and standard deviation were not changed only the part that reads the file of trade history (saved in the Common folder) and function that fills the arrays with the results are amended:
For the above mentioned signal I get this:

Sharp Ratio of Profit/Lots:
Avg of Profit/Vol: 23.9115
StdDev: 88.985
Sharpe_annual(Prof/vol): 8.48

Shart Ration of (Close-Open)/Open:
Avg of Cl-Op/Op: 14.5605
StdDev: 79.645
Sharpe_annual(Cl-Op/Op): 5.77

That looks better than the official figures.

Attached is the script. Just select a signal, save its trading history in the common folder and start the script.

What I did not do was that the arrays of the results should be reduced by the number of entries that are zero as these are used to calculate average and standard deviation!
This thought came to me only this morning.

Sharpe ratio signal - Mathematics in trading: Sharpe ratio and Sortino ratios; There is a difference between the sharpe ratio given on Matat
Sharpe ratio signal - Mathematics in trading: Sharpe ratio and Sortino ratios; There is a difference between the sharpe ratio given on Matat
  • 2022.10.13
  • www.mql5.com
Hello, i wanted to know if there is a difference between the sharpe ratio given on the matatrader software when we do a test and the one given in the signals. There are sharpe ratio, modified sharpe ratio and annual sharpe ratio, and this all is described in the following: the sharpe ratio
Files:
Reason: