I need to get the standard deviation of a custom metric that I'm
computing by iterating through each trade in the BacktesterObject. The
problem is that StDev takes an array.
How do I build an array within the loop to compute the StDev of after
the loop completes? Here's what I'm doing:
if (Status("action") == actionPortfolio) {
bo = GetBacktesterObject();
bo.Backtest(1);
num_trades = 0;
all_rmultiples = 0;
for (trade = bo.GetFirstTrade(); trade; trade = bo.GetNextTrade()) {
num_trades++;
// ... getting r_multiple value here
all_rmultiples[num_trades-1] = r_multiple;
}
rmultiple_stddev = StDev(all_rmultiples, num_trades - 1);
bo.AddCustomMetric("StdDevRs", rmultiple_stddev);
}
StdDevRs is always blank in the backtest report. Any advice?