You need to use foreign
CBT doesnt have a "current" ticker.
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Herman
Sent: Tuesday, 4 November 2008 8:32 PM
To: AmiBroker User Group
Subject: [amibroker] How to use AddCustomMetric() to add external values
I want to simply add numerical values (in columns) from an external function to the BT report.
1) Can someone tell me why the code below does not work? Also, what is the minimum code to accomplish this?
2) Is it possible to add a text column?
Thanks,
herman
function Test()
{
return LastValue( Open );
}
SetOption( "UseCustomBacktestProc", True );
if ( Status( "action" ) == actionPortfolio )
{
bo = GetBacktesterObject();
bo.PreProcess();
for ( bar = 0; bar < BarCount; bar++ )
{
bo.ProcessTradeSignals( bar );
}
T = Test();
bo.PostProcess();
bo.AddCustomMetric( "Test", T );
}
// My trading system would be here
Short = Cover = 0;
Buy = Cross( MACD(), Signal() );
Sell = Cross( Signal(), MACD() );
|