# Calculating Sharpe Ratio

Posted on October 24th, 2012 by Paul

Let N = 250, the number of trading days in a year.

Let ROI[i] = the daily return :: close[i]/close[i-1] – 1

Let Reward = the expected daily return :: mean(ROI[1..N])

Let Risk = the standard deviation of daily returns :: std(ROI[1..N])

Sharpe = sqrt(N) * Reward / Risk

**Sharpe = sqrt(N) * mean(ROI[1..N]) / stddev(ROI[1..N])**

**Sharpe = E[R-Rf]/sqrt(var(R-Rf))**

Note: Risk-free rate is often LIBOR, and can be other metrics as well, but is often ignored for the purpose of calculating the Sharpe ratio.