If you want to display the closed equity as a chart on the backtest report, you'll need to calculate a value for each data point in the time series, which you can do inside the CBT. You can use the high-level CBT which allows you to perform just such calculations after the backtest is executed but before the report is compiled.
There a few ways to code it, here's just one. First loop through the closed trade list to gather the P&L value for each trade. Then loop through the bars and fill in blank values and accumulate the closed equity values on top of the initial equity, at each point a trade is closed. Finally store the result in a static variable.
if( Status("action") == actionPortfolio )
bo = GetBacktesterObject();
bo.Backtest(); // run default backtest procedure
dt = DateTime();
ClosedEquity = 0; // initialise array
ClosedEquity = bo.InitialEquity; // set first array element to initial equity
for (trade = bo.GetFirstTrade(); trade; trade = bo.GetNextTrade())
ClosedEquity += IIf(dt == trade.ExitDateTime, trade.GetProfit(), 0); // store cumulative trade profit values at exit date points
for( i = 1; i < BarCount; i++ ) // loop through bars to fill in blank values and accumulate closed equity values
if (ClosedEquity[i] == 0)
ClosedEquity[i] = ClosedEquity[i - 1];
ClosedEquity[i] += ClosedEquity[i - 1];
Then to get it to display on the report as a separate chart, you'll need to create a new formula in the Formulas\Report Charts folder. The number you give it in the file name is the order in which it will display on the report, eg 4. Closed Equity.afl. The content of the formula is a
Plot statement calling the static variable created above as the input.
Title = "Closed Equity";
SetGradientFill( colorLightBlue, colorPink );
Plot( StaticVarGet("ClosedEquity"), "Closed Equity", ColorBlend( colorLightBlue, colorBlack ), styleGradient | styleLine, Null, Null, 0, -1 );
Then when you run a backtest and pull up the report you'll have something like this:
I'll leave you to figure out how to create the drawdown chart from there. Clue: Study the contents of the default Underwater Equity formula in the Report Charts folder.