Equity Value using Custom Backtesting

How do I find the current equity value to calculate Margin required to trade One lot of Futures? I used Foreign("~~~Equity", "C" ) but the value doesn't change. I tried using Custom Backtester and wrote the following:

SetOption( "UseCustomBacktestProc", True );
if( Status( "action" ) == actionPortfolio )
bo = GetBacktesterObject();
PortEquity = Null;

for( bar = 0; bar < BarCount; bar++ ) 
    bo.ProcessTradeSignals( bar );
    PortEquity[ bar ] = bo.Equity;        


Not sure if this right though. How can I access PortEquity outside the loop?