Sharpe Ratio of daily NLV

SetCustomBacktestProc("");

if( Status("action") == actionPortfolio )
{
bo = GetBacktesterObject();

bo.Backtest(); // run default backtest procedure

st = bo.GetPerformanceStats(0); // get stats for all trades

eq = bo.EquityArray;

SharpeRatio2 = st.GetValue("CAR")/(sqrt(252)*StDev(((eq-Ref(eq,-1))/Ref(eq,-1))*100, BarCount -2 ));

// Here we add custom metric to backtest report
bo.AddCustomMetric( "SharpeRatio2", LastValue(SharpeRatio2) );
}

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.