# Sharpe Ratio calculation in Amibroker

Hi Guys,

How exactly does Amibroker calculate Sharpe Ratio? The calculation method described in the part of the Amibroker guide that talks about the backtest report (website: https://www.amibroker.com/guide/w_report.html) is not consistent with Sharpe Ratio figures of my backtest reports.

For example, attached is a picture of all the trades from a sample backtest (date range 2/1/2018-2/9/2018). Metrics used to calculate Sharpe Ratio (according to the Amibroker guide) are as follows:
-Average % return: 0.99% (the average of the figures in the "% Profit" column)
-SD of returns: 3.42% (the SD of the figures in the "% Profit" column)
-Number of bars per year: 252 (test was done on daily bars and there are 252 trading days per year)
-Average number of bars per trade: 4.42 (the average of the figures in the "# bars" column)
-Annualized average % return: 56% (calculation = 0.99%(252/4.42))
-Annualized SD of returns: 195% (calculation = 3.42%
(252/4.42))
-Risk Free Rate: 0
-Sharpe Ratio: 56%/195% = 0.29

However, the backtest report is showing a Sharpe Ratio of 2.18.

I'm consistently seeing much higher Sharpe Ratios in my backtest reports than when I calculate Sharpe Ratio myself using the methodology described in the guide. Am I missing something?

Thanks, You don't calculate it the way it is described in the guide. Re-read the guide precisely. Besides what version you are using? Anything lower than 6.0 is not supported.

Hi Tomasz- I am using 6.20. The guide says: "Calculation: first average percentage return and standard deviation of returns is calculated. Then these two figures are annualized by multipling them by ratio (NumberOfBarsPerYear)/(AvgNumberOfBarsPerTrade). Then the risk free rate of return is subtracted (currently hard-coded 5) from annualized average return and then divided by annualized standard deviation of returns."

Here is the step by step process according to this description:
1.) "First average percentage return" --> 0.99%
2.) "and SD deviation of returns is calculated" --> 3.42%
3.) "Then these two figures are annaulized by multiplying them by ratio ((NumberOfBarsPerYear)/(AvgNumberOfBarsPerTrade)" --> Ratio is 252/4.42 = 57. So annualized average return is 0.99%*57, or 56%. And annualized SD of returns is 3.42%*57, or 195%.
4.) "Then the risk free rate of return is subtracted from annualized average return" --> 56%-0% - 56% (I set risk free rate to zero in the settings)
5.) "And then divided by annualized SD of returns" --> 56%/195% = 0.29

It's a very simple description. Not sure how else it can be interpreted. Can you please tell me how the program is getting a Sharpe Ratio of 2.18?

Thanks, I think that to annualize standard deviation you need to multiply by the square root of the ratio `(NumberOfBarsPerYear)/(AvgNumberOfBarsPerTrade)`. Making this change to your calculations gives me a result of 2.17.

1 Like