First of all. You use Status{"action") == actionPortfolio, individual
backtest wont go through there.
_____
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Herman
Sent: Friday, 25 July 2008 9:31 AM
To: [email protected]
Subject: Re: [amibroker] How to save Metrics in Composites for Individual
BTs
Thank you Tomasz, but this code still does not work. I changed the StaticVar
to the Text type.
Can you help some more ... ? or does anyone else see the problem?
TIA,
Herman
StaticVarSetText( "Symbol", Name() );
// Demo trading system
Short = Cover = 0;
Buy = Cross( MACD(), Signal() );
Sell = Cross( Signal(), MACD() );
// Using the CBT to retrieve/save metrics
SetOption( "UseCustomBacktestProc", True );
if ( Status( "action" ) == actionPortfolio )
{
bo = GetBacktesterObject();
bo.PreProcess();
MyHistStat1 = Null;
for ( bar = 0; bar < BarCount; bar++ )
{
bo.ProcessTradeSignals( bar );
stats = bo.GetPerformanceStats( 0 );
MyHistStat1[ bar ] = stats.GetValue( "UlcerIndex" ); // any metric can be
retrieved
}
bo.PostProcess();
AddToComposite( MyHistStat1, "~~~UI_" + StaticVarGetText( "Symbol" ) +
"_HISTORICAL", "X", atcFlagEnableInPortfolio | atcFlagDefaults );
}
PlotForeign( "~~~UI_HISTORICAL", "UlcerIndex Historical", colorRed,
styleLine );
-----Original Message-----
From: [email protected] [mailto:amibroker@
<mailto:[email protected]> yahoogroups.com]On Behalf Of Tomasz
Janeczko
Sent: July 24, 2008 3:00 PM
To: [email protected]
Subject: [SPAM]Re: [amibroker] How to save Metrics in Composites for
Individual BTs
The same code. The only distinction is that you need to run INDIVIDUAL
backtest
and use Static variable to save name
StaticVarSet Text ("Symbol", Name() );
// Demo trading system
Short = Cover = 0;
Buy=Cross( MACD(), Signal() );
Sell=Cross( Signal(), MACD() );
// Using the CBT to retrieve/save metrics
SetOption("UseCustomBacktestProc", True );
if( Status("action") == actionPortfolio )
{
bo = GetBacktesterObject();
bo.PreProcess();
MyHistStat1 = Null;
for(bar=0; bar < BarCount; bar++)
{
bo.ProcessTradeSignals( bar );
stats = bo.GetPerformanceStats( 0 );
MyHistStat1[ bar ] = stats.GetValue("UlcerIndex"); // any metric can be
retrieved
}
bo.PostProcess();
AddToComposite( MyHistStat1, "~~~UI_" + StaticVarGet Text ("Symbol") +
"_HISTORICAL", "X", atcFlagEnableInPortfolio | atcFlagDefaults );
}
PlotForeign("~~~UI_HISTORICAL", "UlcerIndex Historical", colorRed, styleLine
);