# Can I use the Sharpe Ratio as an objective function in algorithmic trading?

I’m experimenting with custom loss functions for different trading rules and have come across a few articles citing success in directly using the (negative) Sharpe Ratio as a loss function, particularly within neural networks.

Intuitively, I can see where it would help with portfolio optimization, but I don’t see how it could work for trading a single asset. Given capped trade weights [-1,1], returns are bounded on the upside but stdev can be 0 resulting in infinite Sharpe. Isn’t any algorithm claiming to maximize Sharpe just suboptimally minimizing variance?

• maybe you've already answered your question. In portfolios consisting of multivariate assets' volatilities, $\sigma>0$ and the time frequency is very low, rarely higher than monthly. If intraday fluctuations exhibit no change on the other hand, you might automatically think $\sigma=0$ for one asset, but the Sharpe has a multivariate denominator, the weighted covariance matrix, which makes me think its unlikely for the ratio to hit infinity for a multivariate basket of intraday volatilities. But the answer is the Sharpe ratio can and is used for trading – develarist Sep 25 '20 at 22:40
• How do you think you can obtain an arbitrarily high Sharpe Ratio? If you put more and more weight on the risk free asset, the denominator of the Sharpe Ratio goes to 0 but so does the numerator. – Matthew Gunn Sep 26 '20 at 4:25
• I was a bit unclear. I understand it can be used for multi asset portfolio optimization but I’m interested in its use as loss function for a trading rule. For example, given a single asset, the ideal algorithm would predict a trade position weight between -1 and 1 at a specific point in time. The motivation is to alter bet size towards a Sharpe optimal outcome of weighted returns. I think the solution to this problem trends towards infinite Sharpe (just assign weight 1 to the smallest return and adjust all other weights to match that return) so I’m looking for alternative ideas. – MK23 Sep 28 '20 at 12:58