I've been analyzing NIFTY 50 with some basic trading strategy where I come in and out of trade continuously. The time frame I'm testing my strategy is 7 years. I'm unable to understand how to calculate the Sharpe ratio for this as I am not in trade for equal time intervals.

Also, I've got a loss in the end. Does this mean that I'll have a negative Sharpe ratio?

  • Do you know the formula for Sharpe Ratio? If so which calculation are you stuck on? And yes, if you have negative returns you'll have a negative sharpe ratio.
    – D Stanley
    Commented Apr 23, 2020 at 12:20
  • @DStanley I'm new to all this. I know the formula. I'm not sure how to apply it here. Should I consider the returns only when I'm in trade? Commented Apr 23, 2020 at 12:30
  • Ahh I see. It's an unusual application of sharpe ratio, since the return time periods should be consistent. If you're using it to compare against other investments (like an index) then you should use the same time period and just use the periodic balance (including cash) of your portfolio. If you ignore the times you didn't have a position then it's not an apples-to-apples comparison.
    – D Stanley
    Commented Apr 23, 2020 at 13:09
  • If you edit those details into your question you'll get a better answer.
    – D Stanley
    Commented Apr 23, 2020 at 13:10

1 Answer 1


The Sharpe ratio was initially devised by William Sharpe to compare the returns of mutual funds by removing the volatility from the picture. Since then, people have used the Sharpe ratio on everything that has a return, including trading systems, regardless of whether they trade daily, or once in a while. Trading frequency, position sizing, and the quality of your entries and exits all factor in to get you a Sharpe, and you need to treat everything the same way.

In other words, the sharpe ratio provides a way to normalize returns to make it easier to compare them.

Your case is no different, you need to calculate your return on a regular basis (daily, weekly, monthly, or yearly) by valuing your portfolio at the end of each period (cash + securities), and if you are not in a trade, the return will be 0 for that time period (or whatever interest you may get on your cash). Once you have the returns on a regular basis, you can then calculate the standard deviation of the returns, annualize it, and divide this into the yearly return to get your sharpe ratio (or at least, the 2 values need to be over the same period, i.e. annual return divided by annual standard deviation).

The sharpe ratio is typically calculated using the excess return over the risk free rate, although nowadays, 0 sounds about right, so you can ignore.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .