New MetaTrader 5 platform build 3210: Revised Sharpe Ratio calculation algorithm, new matrix methods and control over indicator minimum/maximum values - page 2

 
Yu Zhang #:
7.Tester: Revised Sharpe Ratio calculation algorithm to match the traditional formula, in which the value corresponds to a one-year interval. The previous algorithm was based on the variability of obtained PnL and it ignored equity fluctuations against open positions. Now the calculation includes equity movements, while the Sharpe ratio is interpreted in a classical way:


Is there a specific formula ?

General sharpe algorithm for forex is always less than 1. 

"in which the value corresponds to a one-year interval" what is this meaning ? 

Can a moderator explain the new Sharpe formula?

 
Thank you for updating the sharp ratio formula on build 3210.
I managed to create an ea that has a good sharp ratio during backtest, but in real trade it's only loss after loss.
It would be great if metaquotes could be shared how to calculate the sharp ratio so that developers in creating ea will have better standards according to the standards of metaquotes.

Note: The bot used is not a history reader.

eurusd

xauusd

gbpusd

 
Sugianto #:
Thank you for updating the sharp ratio formula on build 3210.
I managed to create an ea that has a good sharp ratio during backtest, but in real trade it's only loss after loss.
It would be great if metaquotes could be shared how to calculate the sharp ratio so that developers in creating ea will have better standards according to the standards of metaquotes.

Note: The bot used is not a history reader.


Ya agreed, would be great to know the formula they are using - But you can also optimize using the 'custom criteria' setting in the strategy tester. Use something like the below code (there are many stats to choose from) to setup your custom criteria ...

// Basic sample implementation for optimizing with 'custom' criteria ... 

double OnTester() {
        double np            = TesterStatistics(STAT_PROFIT);              // Net Profit
        double sr            = TesterStatistics(STAT_SHARPE_RATIO);        // Sharpe Ratio
        double nd            = TesterStatistics(STAT_DEALS);               // Number of Deals
        double bd            = fabs(TesterStatistics(STAT_BALANCE_DD));    // Balance Drawdown (dollars)

        custom = (np * sr * nd) / bd;

        return(custom);
}

Re: Misleading values of Sharpe ratio; it may be your backtesting time period is too short and the optimiser is just fitting your EA to the curve of the market for the particular time period you are looking at, regardless whether you are using 'every tick' based history or not.

For the EA to be any good on real money, be sure to backtest for as long a time period as you can afford to.

 
Adam L #:

Ya agreed, would be great to know the formula they are using - But you can also optimize using the 'custom criteria' setting in the strategy tester. Use something like the below code (there are many stats to choose from) to setup your custom criteria ...

Re: Misleading values of Sharpe ratio; it may be your backtesting time period is too short and the optimiser is just fitting your EA to the curve of the market for the particular time period you are looking at, regardless whether you are using 'every tick' based history or not.

For the EA to be any good on real money, be sure to backtest for as long a time period as you can afford to.

Yes, you are right, backtest before only from 2020-2022 period.

And I follow your advice, here are the results of the 2010-2022 backtest. Indeed, there is a certain period, the bot experiences loss.

Thank you for your input.

xauusdm15

gbpusd

eurusd

 
Fernando Carreiro #:

The 15min delayed issue reported on the forum, is now appearing on my setup too with this build.

In my case it is appearing on all my accounts, real and demo, normal and ECN accounts, USD and EUR balances. I have also checked with the broker support and have confirmed that none of the accounts are delayed.

I'm not the only one having this issue, so either it is a bug in MetaTrader build or a setup problem on multiple brokers servers.

Anyone know if this is being discussed on the Russian forum?

I ask, because usually Metaqutes gives priority to issues mentioned there. I tried to use Google translate to search for it there but I did not find anything. I am most probably not using the right words in the search.

 
Fernando Carreiro #:

Anyone know if this is being discussed on the Russian forum?

I ask, because usually Metaqutes gives priority to issues mentioned there. I tried to use Google translate to search for it there but I did not find anything. I am most probably not using the right words in the search.

I have not seen any discussion about it. I could have missed it though.
 
Alain Verleyen #: I have not seen any discussion about it. I could have missed it though.

Have you run across the issue on your end with your setup and broker?

It is not critical, as it only seems to be a "visual" issue, but since nothing has been said about it, I would just like to make sure there isn't any other problems associated with it.

 
Fernando Carreiro #:

Have you run across the issue on your end with your setup and broker?

It is not critical, as it only seems to be a "visual" issue, but since nothing has been said about it, I would just like to make sure there isn't any other problems associated wit it.

I have seen this display, but I didn't check further. Once the market will be open I will check all is ok "live".
 
Alain Verleyen #: I have seen this display, but I didn't check further. Once the market will be open I will check all is ok "live".

Thanks! I will also be doing some checking on my own setups on Monday.

 
Sugianto #:

Yes, you are right, backtest before only from 2020-2022 period.

And I follow your advice, here are the results of the 2010-2022 backtest. Indeed, there is a certain period, the bot experiences loss.

Thank you for your input.


No problems at all - As I can see from the graphical output, the last few years are over-represented on XAUUSD, which probably means lack of available data from broker (a lot of them limit historic data, to cut down on bandwidth) + varying spreads which make some strategies more effective at some times and less affective at others. Having said all that the Balance curve looks amazing - However if you are optimising using the 'Profit in Pips' option this may lead to misleading results, as this option negates swaps / commissions and margin calls, and also negates issues with the quoting currency, as you are effectively trading in 'pips', not dollars or pounds or yen etc etc.

Also, I would say the drawdown is ridiculously small for such a large amount of trades, off an initial balance of 2000 USD. However I concede you may using very low leverage and hence your balance and equity output will be joined at the hip.

Finally, one time worn issue with backtesting over any time period are results that shoot off into the hundreds of millions. Now it's true some brokers will allow massive trades that facilitate this kind of account growth, but in my experience it's not a practical expectation for day to day trading, particularly if you intend to extract an income from your trading? And Mql5 has some functions you can use to simulate making withdrawals along the way. So I recommend adding a withdrawal simulation to your backtesting, to see if the robot performs equally well, if you extract say the difference between 'BALANCE - 100,000', every time BALANCE exceeds 150,000. If it still runs smoothly with super low drawdown, over all the rocky history of the last several years - Particularly for GOLD (XAUUSD) - then you have a killer system indeed !!!

All the best in beating the 'market' - aka, Liquidity Providers, Hedge Funds and High Net worth Individuals :D

Reason: