Thanks a lot guys – super helpful!!
If anyone else is trying this, the only thing I needed to add to Matthew’s code is to define the static variables prior to the CBT code, otherwise the fields are just returned as EMPTY. For example:
StaticVarSet(Ticker + “Volume”, Volume);
StaticVarSet(Ticker + “Turnover”, Volume*((H+L)/2));
//
SetCustomBacktestProc(“”); //Set Custom Back Tester
CBT code… // NOTE THAT I DIDN’T INCLUDE THE ENTIRE CBT CODE
// Custom Metrics for Trade List
for ( trade = bo.GetFirstTrade( ); trade; trade = bo.GetNextTrade( ) )
{
symbolVolume = StaticVarGet( trade.Symbol + “Volume” );
symbolTurnover = StaticVarGet( trade.Symbol + “Turnover” );
trade.AddCustomMetric( “Daily Volume”, NumToStr(Lookup( symbolVolume, trade.EntryDateTime ),1.3) );
trade.AddCustomMetric( “Daily Turnover”, NumToStr(Lookup( symbolTurnover, trade.EntryDateTime ),1.3) );
}
bo.PostProcess(); // Do post-processing (always required)