# Can I calculate Sharpe ratio by running over many samples?

I have an algorithm that I am backtesting 200 times. It trades over 200 trading days per iteration.

My sharpe ratio is calculated as follows:

sharpe_ratio = (results['Reward'].mean() - 3) / results['Reward'].std()


Where 3 is my risk free rate of return. Is it valid to calculate the returns this way and use them to calculate my sharpe ratio?

• Assuming you are trying to determine your max Sharpe ratio for a portfolio of assets, 200 iterations is way too small. I don't think I ever use less than 100k iterations when doing any optimization whether it be a mean-variance optimization or something more robust. Without any more information, there is no way to tell if your returns are correct or not. Annualizing Sharpe is customary. Being that you are taking the mean of what looks to be a pandas dataframe series, I assume it has not been annualized...you need to use annualized returns and annualized volatility. – amdopt Apr 12 at 13:38

## 1 Answer

This is problematic for a couple reasons.

To summarize, you have some trading strategy for which you're simulating performance over a 200 day period 200 times? Are you also simulating return data to produce the 200 different paths then (?). Traditionally for backtesting we use an actual historical dataset for the asset in question, not simulated returns which are obviously subject to all of your simulation assumptions. Using simulated returns basically defeats the point of backtesting since you're effectively creating new asset(s) with your simulated returns.

That aside, it isn't clear what units are on any of your variables. Is your 'reward' column simply PnL on each of your entry/exit positions? Traditionally we assemble PnL or return over some specified CONSISTENT interval (eg, daily or monthly) before calculating anything related to Sharpe. Also, what are the units on rf. 3...%?