Get startedGet started for free

Cash Sharpe ratio

When working with cash profit and loss statistics, quantstrat offers a way to compute a Sharpe ratio not just from returns, but from the actual profit and loss statistics themselves. A Sharpe ratio is a metric that compares the average reward to the average risk taken. Generally, a Sharpe ratio above 1 is a marker of a strong strategy.

In this exercise, you will see that because of trading P&L (profit and loss), one can compute a Sharpe ratio based on these metrics. The code below can be used to compute the Sharpe ratio based off of P&L. Copy the code in the console. In what range is the Sharpe ratio you obtain?

portpl <- .blotter$portfolio.firststrat$summary$Net.Trading.PL
SharpeRatio.annualized(portpl, geometric=FALSE)

This exercise is part of the course

Financial Trading in R

View Course

Hands-on interactive exercise

Turn theory into action with one of our interactive exercises

Start Exercise