# Calculating Sharpe ratio for my trade strategy

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. 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. Commented Apr 23, 2020 at 13:09
• If you edit those details into your question you'll get a better answer. Commented Apr 23, 2020 at 13:10