March 11, 2006
How to create copy of portfolio equity?
As you know Portfolio backtester creates special ticker “~~~EQUITY” which holds portfolio-level equity of the system under test. Some may find it useful to save this equity into another symbol after backtest for future analysis and/or comparison. Good news is that it is possible to do that automatically using custom backtester procedure and AddToComposite function. The formula below shows how.
// YOUR TRADING SYSTEM HERE
SetCustomBacktestProc("");
if( Status("action") == actionPortfolio )
{
bo = GetBacktesterObject();
bo.Backtest();
AddToComposite( Foreign("~~~EQUITY","C"),
"~~~MY_EQUITY_COPY", "X",
atcFlagDeleteValues | atcFlagEnableInPortfolio );
}
Please note that prior to version 4.78.1 BETA, atcFlagEnableInPortfolio did not work in combination with atcFlagCompositeGroup (or atcFlagDefaults) so we needed to avoid this flag in the code above, to make it work fine with previous versions of AmiBroker. In version 4.78.1 it works with all combinations of flags, so you don’t need to worry about this any more.
Filed by Tomasz Janeczko at 2:32 pm under AFL, Custom Backtest

How do you watch your real equity curve? I mean after manually putting in real life
buy/sell and deposit/withdraw actions. Is it possible to just plot the equity curve
without any backtesting or similar?
Yes it is possible, this article shows how to do that: http://www.amibroker.com/kb/2006/05/06/discretionary-equity/
I can’t get it to work TJ, I tried running this code in the AA Portfolio Tester:
Buy=Sell=Short=Cover=0;
if( Status(”action”) == actionPortfolio ) _TRACE(”# actionPortfolio test”);
DBV Shows no output, also “actionPortfolio” is not documented in the Help.