NinjaScript > Language Reference > Strategy > TradeCollection > TradesPerformance >

GetSharpeRatio()

Print this Topic Previous pageReturn to chapter overviewNext page

Definition
Returns the Sharpe ratio for the TradeCollection object calculated from a defined risk-free rate.
 

Method Return Value

A double value that represents the Sharpe ratio.

 

Syntax
<TradeCollection>.TradesPerformance.GetSharpeRatio(double riskFreeRate)

 
Parameters

riskFreeRate

The risk-free rate to calculate the Sharpe ratio from

 

 

Examples

double sharpeRatio = Performance.AllTrades.TradesPerformance.GetSharpeRatio(0.035);
Print("The Sharpe ratio based on a 3.5 percent risk-free rate is " + sharpeRatio);