Dear Traderji and Amibroker friends,
for my TS I need to know Equity array step by step during backtest.
From Amibroker usersguide:
'if you call Foreign("~~~Equity", "C" ) from within the formula that is currently being backtested, you will receive previous backtest equity, not current one.
To access current equity, you need to use custom backtester interface. It has
"Equity" property in the backtester object that holds current account equity. If
you need equity as an array there are two choices, either collect values this
way:
SetOption("UseCustomBacktestProc", True );
if( Status("action") == actionPortfolio )
{
bo = GetBacktesterObject();
bo.PreProcess(); // Initialize backtester
PortEquity = Null; // will keep portfolio equity values
for(bar=0; bar < BarCount; bar++)
{
bo.ProcessTradeSignals( bar );
// store current equity value into array element
PortEquity[ i ] = bo.Equity;
}
bo.PostProcess(); // Finalize backtester
But it doesnt work: during backtest 'if function' is not read cause
Status("action") == actionPortfolio never comes true.
so I changed actionPortfolio with actionBacktest
Status("action") == actionBacktest
but I have this error: 'COM/object handle is null'
is there a way to obtain the equity array step by step while backtest is running?
thanks
cippo
for my TS I need to know Equity array step by step during backtest.
From Amibroker usersguide:
'if you call Foreign("~~~Equity", "C" ) from within the formula that is currently being backtested, you will receive previous backtest equity, not current one.
To access current equity, you need to use custom backtester interface. It has
"Equity" property in the backtester object that holds current account equity. If
you need equity as an array there are two choices, either collect values this
way:
SetOption("UseCustomBacktestProc", True );
if( Status("action") == actionPortfolio )
{
bo = GetBacktesterObject();
bo.PreProcess(); // Initialize backtester
PortEquity = Null; // will keep portfolio equity values
for(bar=0; bar < BarCount; bar++)
{
bo.ProcessTradeSignals( bar );
// store current equity value into array element
PortEquity[ i ] = bo.Equity;
}
bo.PostProcess(); // Finalize backtester
But it doesnt work: during backtest 'if function' is not read cause
Status("action") == actionPortfolio never comes true.
so I changed actionPortfolio with actionBacktest
Status("action") == actionBacktest
but I have this error: 'COM/object handle is null'
is there a way to obtain the equity array step by step while backtest is running?
thanks
cippo