I'm trying to get an open equity plot (equity - closed equity). I'm not a programmer so I have little luck with CBT. I tried the following, but I understand this does not create an array at every bar. Any suggestions? Thanks in advance.
SetCustomBacktestProc( "" );
if ( Status( "action" ) == actionPortfolio ) {
bo = GetBacktesterObject();
bo.Backtest(1);
sumprofit = 0;
for ( trade = bo.GetFirstOpenPos(); trade; trade = bo.GetNextOpenPos() ) {
profit = trade.GetProfit();
sumprofit=sumprofit+profit;
Open_equity_name = "~OpenProfit";
flag = atcFlagDeleteValues | atcFlagEnableInPortfolio;
AddToComposite( sumprofit, Open_equity_name, "C", flag );
}
bo.ListTrades();
}