# Monthly returns and Sharpe ratio in backtest

Questions about MultiCharts .NET and user contributed studies.
YanickB
Posts: 4
Joined: 13 Aug 2013

### Monthly returns and Sharpe ratio in backtest

Hello,

I'm realizing that percent monthly returns under 'Monthly Period Analysis' in backtest reports are calculated based on the equity evolution instead of on an allocated amount to the strategy. What's that means is that if a strategy is doing well over a period of time, percentage returns will get decreasing even if they're still good.

Since money made is not reinvested in the strategy by taking larger positions, shouldn't it be more accurate to use an allocated amount for these calculations instead of the equity?

And this brings me to another question... Sharpe ratio is calculated based on monthly returns; are these monthly returns calculated the same way?

Thanks.

Henry MultiСharts
Posts: 9046
Joined: 25 Aug 2011
Has thanked: 1250 times
Been thanked: 2905 times

### Re: Monthly returns and Sharpe ratio in backtest

YanickB wrote:Hello,
I'm realizing that percent monthly returns under 'Monthly Period Analysis' in backtest reports are calculated based on the equity evolution instead of on an allocated amount to the strategy. What's that means is that if a strategy is doing well over a period of time, percentage returns will get decreasing even if they're still good.
Since money made is not reinvested in the strategy by taking larger positions, shouldn't it be more accurate to use an allocated amount for these calculations instead of the equity?
Hello YanickB,

That is possible to have the strategy programmed to reinvest the money you have earned.
You can access the actual equity at any given time this way: IStrategy.InitialCapital Property + ClosedEquity + OpenEquity.

To dynamically calculate contract amount you can try to implement for ex. the following logic:
value1 = ( InitialCapital + OpenEquity + ( ClosedEquity - InitialCapital ) ) / ( close * bigpointvalue );
buy value1 contracts next bar market;

In portfolio backtester that is also possible to have the trade size as the percent of equity.

YanickB wrote:And this brings me to another question... Sharpe ratio is calculated based on monthly returns; are these monthly returns calculated the same way?
The formula for the Sharpe ratio is SR = (MR - RFR) / SD, where:
MR is the average return for period (monthly),
RFR is the risk-free rate of return.
You set the RFR as Interest rate in the Properties tab of the Strategy Properties dialog box.
SD is the standard deviation of returns.

YanickB
Posts: 4
Joined: 13 Aug 2013

### Re: Monthly returns and Sharpe ratio in backtest

Hello Henry,

Thanks for your answer. It's great to know we can set a strategy to automatically re-invest money earned.

However, when we are NOT reinvesting, monthly returns are incorrect. I attached a print screen of a strategy that show pretty well what I mean. Have a look at the returns of 03/2014(2319\$ - 4.45%) and 11/2012(2867\$ - 15.54%).

If these returns were calculated based on the amount invested in the strategy, their percentage would be similar. However, since the equity has considerably grown, the newest return is much smaller because the divider(equity) is much bigger.

Now, if monthly returns are calculated that way for Sharpe and other ratios, their values can't be correct; the numerator(Average Monthly returns - RFR) is decreasing for a strategy that goes well...

I think the way monthly returns are actually calculated would be appropriate for buy and hold but there should be something more appropriate for auto trading.

Thanks.
Attachments
Capture d’écran 2014-04-22 à 13.24.07.png (431.16 KiB) Viewed 503 times

Henry MultiСharts
Posts: 9046
Joined: 25 Aug 2011
Has thanked: 1250 times
Been thanked: 2905 times

### Re: Monthly returns and Sharpe ratio in backtest

Hello YanickB,

The current calculation is considered to be the correct one. We appreciate your suggestion. It has been forwarded to the management of the company. Please note that even though we value your opinion not all requests can be implemented due to the fact that some features do not fit into our current roadmap.

PBJ
Posts: 4
Joined: 03 Jul 2014

### Re: Monthly returns and Sharpe ratio in backtest

Hi,

I'm trying out MC .NET64 v9 beta 1 and I must say this Sharpe ratio calculation was the most confusing thing ever. I almost decided to stop the trial, considering that if performance reports cannot be trusted, the platform isn't going to work for me. As a developer, I recognize and respect the tremendous amount of efforts and manhours that have been put into MC, and have found the documentation and support to be extremely effective. That said, as others have pointed out, a Sharpe ratio is always, always presented annualized. The most used flavor is [ (daily return %) x 252 ] / [std dev of daily returns %] x sqrt(252) ]. Works the same with monthly, using 12 instead of 252. People have developed "modified" versions over time, to account for skewness of returns and more sophisticated annualization methods... but that one is the standard. If backward compatibility is an issue, why not add a metric to the performance report called "Annualized Sharpe Ratio" below the current "Sharpe Ratio"? Those used to the current version will remain satisfied, and the rest of the community will applaud. I'm pretty sure I'm not the only one who worried about the quality of risk metrics when looking at the current Sharpe ratio for the first time.