Continuing the discussion from Formatting Custom Metrics?
and How To - Arrange custom metric columns in Backtest Trade Report:
Is it possible to adjust the custom metric column width that is initially displayed in the backtest report? I have tried the following code but the width portion does not appear to be applied.
SetCustomBacktestProc( "" );
if ( Status( "action" ) == actionPortfolio )
{
bo = GetBacktesterObject();
// run default backtest procedure without generating the trade list
bo.Backtest( True );
// iterate through closed trades
for ( trade = bo.GetFirstTrade( ); trade; trade = bo.GetNextTrade( ) )
{
trade.AddCustomMetric( StrFormat("%-30s","Custom Metric1"), StrFormat("%-30s","Hello World" ));
trade.AddCustomMetric( StrFormat("%-30s","Custom Metric2"), StrFormat("%-30s",""));
}
// iterate through open positions
for ( trade = bo.GetFirstOpenPos( ); trade; trade = bo.GetNextOpenPos( ) )
{
trade.AddCustomMetric( StrFormat("%-30s","Custom Metric1"), StrFormat("%-30s","Hello World" ));
trade.AddCustomMetric( StrFormat("%-30s","Custom Metric2"), StrFormat("%-30s","Goodbye World"));
}
// generate trade list
bo.ListTrades( );
}
// your trading system here
Buy = Cross( MACD(), Signal() );
Sell = Cross( Signal(), MACD() );