## Sharpe Ratio

The original Sharpe Ratio (SR) was authored by William Forsyth Sharpe; it is given here with a correction done in 1994. It is designed to evaluate how well an investor is compensated for the risk taken. The higher the SR the better the instrument’s performance. The main ingredients are current price and a prior price which are adjusted with the user defined safe return. An average and standard deviation are taken; and the SR is their quotient. The user must select linear bars but may change the input (close), period length and a safe value. This indicator’s definition is further expressed in the condensed code given in the calculation below.

### How To Trade Using the Sharpe Ratio

The Sharpe Ratio may be used to evaluate a instrument’s performance. No trading signals are calculated.

### How To Access in MotiveWave

Go to the top menu, choose Study>Performance>Sharpe Ratio

or go to the top menu, choose Add Study, start typing in this study name until you see it appear in the list, click on the study name, click OK.

Important Disclaimer: The information provided on this page is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security. Please see our Risk Disclosure and Performance Disclaimer Statement.

### Calculation

//input = price, user defined, default is close
//period = p1, user defined, default is 30
//safe = safe return percentage, user defined, default is 2
//av = average, pow = power, index = current bar number
//sma = simple moving average, sdDev = standard deviation

```safe = safe / 100; //convert from percent to decimal
BarSize bar = getBarSize();
if (bar.getType() == BarSizeType.LINEAR) barMin = bar.getInterval();
else return;
minPerYr = 60*24*30*12;
barsPerYr = minPerYr/barMin;
adjSafe = Math.pow((1 + (safe)), p1/barsPerYr) - 1; //safe return per period compounded
priorP = price[index-p1];
ret = ((price/priorP)-1) - adjSafe; //safe return subtracted here to reflect Sharpe 1994 revision
av = sma(index, p1, RET);
std = sdDev(index, p1, RET)[0];
Plot: sharpe = av/std;```